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
- NSURL * url = [NSURL URLWithString: @ myapp: // test? Para1 = 1 limit 2 = 2];
If ([ourApplication canOpenURL: ourURL]) {// check that
- [[UIApplication sharedApplication] openURL: url];
- }
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.