I'm running into an issue where I try and open an app from within another app but for some strange reason it keep opening the app thats already open, not the new app its supposed to open. I added the url scheme and and identifier to the plist and added the url scheme to the LSApplicationQueriesSchemes so it can be opened from within the app. I tried testing the url scheme in safari and for some strange reason it opens my app instead of the app its supposed to open. its like its on a loop, it keeps pointing to my app instead of the app its supposed to open.
This is how I'm opening it in code:
func openAppFromMenu(inAppURL: URL?, appStoreURL: URL?) {
if inAppURL != nil {
if let inApp = inAppURL {
if UIApplication.shared.canOpenURL(inApp) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(inApp)
}
else {
UIApplication.shared.openURL(inApp)
}
}
else {
//redirect to safari because the user doesn't in app
print("App not installed")
self.appStoreURL = appStoreURL
addAlert()
}
}
} else {
//redirect to safari because the user doesn't in app
print("App not installed")
self.appStoreURL = appStoreURL
addAlert()
}
}