IOS App Launch Option, ioslaunch

Source: Internet
Author: User

IOS App Launch Option, ioslaunch

When the iOS program starts, it always calls application: didfinishlaunchingwitexceptions:. The second parameter launchOptions is an object of the NSDictionary type, which stores the reason for the program to start.

 

For possible key values in launchOptions, see the Launch Options Keys section of the UIApplication Class Reference.

1. If the user starts it directly, there is no data in lauchOptions;

2. If other applications start through openURL:UIApplicationLaunchOptionsURLKeyThe corresponding object is the startup URL (NSURL ),UIApplicationLaunchOptionsSourceApplicationKeyCorresponding to the bundle ID (NSString) of the started source application );

3. If a local notification is enabledUIApplicationLaunchOptionsLocalNotificationKeyIt corresponds to the local notification object (UILocalNotification) that starts the application );

4. If a remote notification is enabledUIApplicationLaunchOptionsRemoteNotificationKeyIt corresponds to the remote Notification Information userInfo (NSDictionary) that starts the application );

5. other keys includeUIApplicationLaunchOptionsAnnotationKey,UIApplicationLaunchOptionsLocationKey,UIApplicationLaunchOptionsNewsstandDownloadsKey.

 

 

If you want to make some distinction at startup, you need to process the following code. For example, your application can be called by another application (as a sub-Application of the Application). To achieve single-point logon, you must make a reasonable verification at the startup code, and skip logon.

Java code
  • -(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions
  • {
  • NSURL * url = [options objectForKey: UIApplicationLaunchOptionsURLKey];
  • If (url)
  • {
  • }
  • NSString * bundleId = [options objectForKey: UIApplicationLaunchOptionsSourceApplicationKey];
  • If (bundleId)
  • {
  • }
  • UILocalNotification * localNotify = [options objectForKey: UIApplicationLaunchOptionsLocalNotificationKey];
  • If (localpolicy)
  • {
  • }
  • NSDictionary * userInfo = [options objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
  • If (userInfo)
  • {
  • }
  • }
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.