Jump between ios apps, pass values, and jump between ios apps
The jump between two apps is achieved through [[UIApplication sharedApplication] openURL: url.
1. First set the url of the first APP
2. Set the url of the second APP.
3. Jump
NSString *urlString = [NSString stringWithFormat:@"AppJumpSecond://%@",textField.text];[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
I will upload textField text here.
The same is true on the second page.
NSString *urlString = [NSString stringWithFormat:@"AppJumpFirst://%@",textField.text];[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
In this way, you can jump to each other.
4. Process uploaded data
After the textField data is uploaded
-(BOOL) application :( UIApplication *) application openURL :( NSURL *) url sourceApplication :( NSString *) sourceApplication annotation :( id) in the annotation method.
Set attributes in AppDelegate
@ Property (nonatomic, strong) RootViewController * rvc;
Add the didfinishlaunchingwitexceptions Method
self.rvc = [[RootViewController alloc] init];UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:self.rvc];self.window.rootViewController = nc;
Add code block
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ self.rvc.textField.text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; return YES;}
This allows textField to display data transmitted from another page.