IOS App Launch Option

Source: Internet
Author: User

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
  1. -(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
  2. {
  3. Nsurl *url = [Options Objectforkey:uiapplicationlaunchoptionsurlkey];
  4. if (URL)
  5. {
  6. }
  7. NSString *bundleid = [Options Objectforkey:uiapplicationlaunchoptionssourceapplicationkey];
  8. if (Bundleid)
  9. {
  10. }
  11. Uilocalnotification * localnotify = [options Objectforkey:uiapplicationlaunchoptionslocalnotificationkey];
  12. if (localnotify)
  13. {
  14. }
  15. Nsdictionary * userInfo = [options Objectforkey:uiapplicationlaunchoptionsremotenotificationkey];
  16. if (userInfo)
  17. {
  18. }
  19. }

IOS App Launch Option

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.