if UIApplication.shared.canOpenURL(openURL) {
UIApplication.shared.openURL(openURL)
} else if UIApplication.shared.canOpenURL(installUrl)
UIApplication.shared.openURL(installUrl)
}
let appURLScheme = "MyAppToOpen://"
guard let appURL = URL(string: appURLScheme) else {
return
}
if UIApplication.shared.canOpenURL(appURL) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(appURL)
}
else {
UIApplication.shared.openURL(appURL)
}
}
else {
// Here you can handle the case when your other application cannot be opened for any reason.
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
// You we get the call back here when App B will try to Open
// sourceApplication will have the bundle ID of the App B
// [url query] will provide you the whole URL
// [url query] with the help of this you can also pass the value from App B and get that value here
}