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
- NSURL *url = [nsurl urlwithstring:@ " myapp://test?para1=1?2=2 " ];  
-
if ([ourapplication canopenurl : Oururl]) { Span class= "S3" >// detect already installed
- [[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