- URL-, App2 App1. App1, .
ObjC
- (void)checkForSiblingApp {
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"<app2scheme>://"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"<app2scheme>://"]];
} else {
[self performSelector:@selector(checkForSiblingApp) withObject:nil afterDelay:60];
}
}
Swift
func checkForSiblingApp() {
if UIApplication.sharedApplication().canOpenURL(NSURL(string: "<app2scheme>://")!) {
UIApplication.sharedApplication().openURL(NSURL(string: "<app2scheme>://")!)
} else {
let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(60 * Double(NSEC_PER_SEC)))
dispatch_after(delayTime, dispatch_get_main_queue()) {
self.checkForSiblingApp()
}
}
}
, . Inter-App Communication, .