The possible key values in Launchoptions are shown in the Launch Options keys section of uiapplication Class reference.
- If the user launches directly, no data in the lauchoptions;
- If it is started by another application through OpenURL: Uiapplicationlaunchoptionsurlkey, the corresponding object is the startup 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 (uilocalnotification) for the startup application;
- 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.
The code distinguishes between different launches, such as click-to-push to make jumps
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions{ Nsurl *url = [options Objectforkey:uiapplicationlaunchoptionsurlkey]; if (URL) { //by another application via OpenURL: Boot } nsstring *bundleid = [Options Objectforkey: Uiapplicationlaunchoptionssourceapplicationkey]; if (Bundleid) { //The bundle ID of the source application that corresponds to launch (nsstring) } uilocalnotification * localnotify = [options Objectforkey:uiapplicationlaunchoptionslocalnotificationkey]; if (localnotify) { //click on local push in after } nsdictionary * userInfo = [Options Objectforkey: Uiapplicationlaunchoptionsremotenotificationkey]; if (userInfo) { //Click to push in after }}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
IOS App Launch Option (click to push Action)