<div class="p1">少し古い本を読んでいると、iOS アプリケーションの起動時に UIApplicationDelegate プロトコルの applicationDidFinishLaunching: が呼ばれることになっている。しかし新しい本だと application:didFinishLaunchingWitnOptions: が使われている。</div><div class="p2">
</div><div class="p1">両者は基本的には同じだが、前者が iOS 2.0以降、後者が iOS 3.0以降で使えるメソッドで、いまは後者の利用が強く推奨されている。</div><div class="p1">
</div><div class="p1">Appleのドキュメントにはこう記されている。</div><div class="p2">
</div><blockquote class="tr_bq">applicationDidFinishLaunching:
This method is used in earlier versions of iOS to initialize the application and prepare it to run. In iOS 3.0 and later, you should use theapplication:didFinishLaunchingWithOptions: instead.</blockquote>
<blockquote class="tr_bq">application:didFinishLaunchingWithOptions:
Note: It is highly recommended that you use this method to initialize your application and not the applicationDidFinishLaunching: method.</blockquote><div class="p7">
</div><div class="p1">application:didFinishLaunchingWithOptions: (NSDictionary*) launchOptions には、アプリケーションの起動理由(the reason the application was launched)が入っている。起動理由というのは、他のアプリケーションから openURL: で起動されたときの NSURL や、起動元のアプリケーションの bundle ID だ。なぜこのアプリケーションが起動に至ったのかがわかる。</div><div class="p2">
</div><blockquote class="tr_bq">Launch Options Keys
Keys used to access values in the launch options dictionary passed to the application:didFinishLaunchingWithOptions: method of the application delegate.
NSString *const UIApplicationLaunchOptionsURLKey;
NSString *const UIApplicationLaunchOptionsSourceApplicationKey;
NSString *const UIApplicationLaunchOptionsRemoteNotificationKey;
NSString *const UIApplicationLaunchOptionsAnnotationKey;
NSString *const UIApplicationLaunchOptionsLocalNotificationKey;
NSString *const UIApplicationLaunchOptionsLocationKey;
NSString *const UIApplicationLaunchOptionsNewsstandDownloadsKey;</blockquote><div class="p2">
</div>