IOS apps call each other
Caller:
You only need to execute the following call method, with ": //" as the separator, the left side is the address of the APP to be called, and the right side is the parameter you want to pass to the APP.
NSURL *url = [NSURL URLWithString:@"Ceshi001://aaaaaaa"]; [[UIApplication sharedApplication] openURL:url];
Called:
Add the URL types attribute to the info. plist file, as shown in:
And implement the following delegate Method
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ NSString*text=[[url host]stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSLog(@"%@",text); NSLog(@"%@",url.description); NSLog(@"%@",sourceApplication); return YES;}
The printed information is as follows:
015-05-26 15:26:00. 821 HAppTest [5365: 1695127] aaaaaaa
15:26:00. 822 HAppTest [5365: 1695127] Ceshi001: // aaaaaaa
15:26:00. 822 HAppTest [5365: 1695127] com. huaxun. AppTest