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.
The possible key values in Launchoptions are shown in the Launch Options keys section of uiapplication Class reference.
1, if the user directly start, lauchoptions no data;
2, if the other application through OpenURL: Start, then the uiapplicationlaunchoptionsurlkey corresponding object is the boot URL (nsurl), Uiapplicationlaunchoptionssourceapplicationkey The bundle ID of the source application that corresponds to the startup (NSString);
3, if initiated by local notification, then Uiapplicationlaunchoptionslocalnotificationkey corresponding to the launch application of the local notification object (uilocalnotification);
4, if started by remote notification, then Uiapplicationlaunchoptionsremotenotificationkey corresponding to the launch application of the remote Notification information userinfo (nsdictionary);
5, other key also has 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.
Java code
- -(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)
- {
- }
- }
IOS App Launch Option