

Like a user Info dictionary, -application:did Finish Launching With Options: can get information for particular named keys in launch Options. An app could also be launched in response to a push notification, or a significant change in device location.ĭetermining why and how an app launched is the responsibility of the launch Options parameter.


For example, an app registered for a custom URL scheme, such as twitter://, could be launched as a result of opening a URL. It is called by the application to notify its delegate that the launch process is finishing, and nearly ready to run.Īn app launches when its icon is tapped on Springboard, but there are several other occasions in which an app can be launched. This week, all will be revealed in this NSHipster tell-all about the least understood parameter of the most important method in UIKit: launch Options.Įvery app begins with UIApplication Delegate -application:did Finish Launching With Options: (or more accurately, -application:will Finish Launching With Options:, when implemented). Hiding in plain sight, launch Options contains a wealth of keyed knowledge that speaks to the multitude of ways an app can be launched on iOS. AppDelegate is the dumping ground for functionality in iOS.Īpplication lifecycle management? URL routing? Notifications? Core Data incantations? Invasive and monolithic 3rd-party SDK initialization? Random functionality that doesn’t seem to fit anywhere else? Just stash it in App Delegate.m!Īnd of all of the crowded, over-loaded parts in AppDelegate, -application:did Finish Launching With Options: is the most congested of all.įor many developers, the launch Options parameter is akin to the String args argument of a Java main method-something ignored in the rush to building an application.
