Jump between iOS Apps

Source: Internet
Author: User

Let 's talk about How to open app2 from App1 in an iOS opener.

The basic idea is that you can set a URL for app2, in App1 open the URL to open the app2, in this process, you can transfer some parameters. The following is a discussion of the specific implementation process.

1. Defining a URL in App2 info.plist is to add a URL types to the file. Can be added by pressing.


2. Open the URL that you just defined in App1 's code, as follows:

[CPP]View Plaincopy
  1. NSURL  *url = [nsurl urlwithstring:@ " myapp://test?para1=1?2=2 " ];  
  2. if ([ourapplication canopenurl : Oururl]) { Span class= "S3" >// detect already installed

  3. [[UIApplication sharedapplication] openurl:url];

of course, the form of this URL can be other forms, as long as "myapp://" to start.

In this way, you can open app2 in App1.

When opened, App2 's appdelegate is called.

-(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 self- defined , there is a case where the URL is duplicated. The test found that if you try to open the URL, the first installed one will open .

Jump between iOS Apps

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.