Application:didfinishlaunchingwithoptions is always called when the IOS program starts: The second parameter is launchoptions an object of type Nsdictionary, which stores the reason for this program to start.
see the possible key values in the Launchoptions uiapplication Class Reference The launch Options keys section.
If the user launches directly, no data in the lauchoptions;
if the other application passes OpenURL: start, the Uiapplicationlaunchoptionsurlkey corresponding object is the boot URL (nsurl), Uiapplicationlaunchoptionssourceapplicationkey the bundle ID of the source application that corresponds to the startup (NSString);
if initiated by a local notification, the Uiapplicationlaunchoptionslocalnotificationkey corresponds to the local notification object for the startup application (uilocalnotification );
If initiated by a remote notification, the Uiapplicationlaunchoptionsremotenotificationkey corresponds to the remote notification information userinfo (nsdictionary) that initiates the application;
Other keys also have Uiapplicationlaunchoptionsannotationkey,uiapplicationlaunchoptionslocationkey,
Uiapplicationlaunchoptionsnewsstanddownloadskey.
If you want to make some distinctions at startup, you need to do this in the code below.
For example: Your app can be picked up by some other app (as a sub-app for that app), and to achieve a single sign-on, you need to make a reasonable verification in the boot code and skip the login.
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
{
Nsurl *url = [Options Objectforkey:uiapplicationlaunchoptionsurlkey];
if (URL)
{
}
NSString *bundleid = [Options Objectforkey:uiapplicationlaunchoptionssourceapplicationkey];
if (Bundleid)
{
}
Uilocalnotification * localnotify = [options Objectforkey:uiapplicationlaunchoptionslocalnotificationkey];
if (localnotify)
{
}
Nsdictionary * userInfo = [options Objectforkey:uiapplicationlaunchoptionsremotenotificationkey];
if (userInfo)
{
}
}