Jump between IOS apps

Source: Internet
Author: User

Jump between IOS apps

Let's discuss how to enable app2 from app1 in iOS development.

The basic idea is that you can define a URL for app2. In app1, you can open app2 by opening this URL. In this process, you can transmit some parameters. The following describes the specific implementation process.

1. the URL defined in info. plist of app2 is to add the URL types to the file. You can add them as per.

 

2. Open the URL just defined in the app1 Code. The Code is as follows:

 

[Cpp
  1. NSURL * url = [NSURL URLWithString: @ myapp: // test? Para1 = 1 limit 2 = 2];
  2. If ([ourApplication canOpenURL: ourURL]) {// check that

  3. [[UIApplication sharedApplication] openURL: url];
  4. }

     

    Of course, this URL can be in other forms, as long as it starts with myapp.

    In this way, app2.

    After it is enabled, the app2's AppDelegate

     

     

     

    - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {    if ([[url host] isEqualToString:@com.taobao.dgb]){NSLog(@------%@----%@,[url host],[url query]);        NSString *viewId = [[url query] substringFromIndex:[[url query] rangeOfString:@viewId=].location + 7];        if ([viewId isEqualToString:@letters]){        }    }    return YES;}


     

     

    Because the URL is defined by itself, there may be duplicate URLs. After testing, it is found that if you try to open this URL, the application installed first will be opened.

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.