As part of Apple’s security changes in iOS9, use of custom URL Schemes to open other apps (via system.openURL(“myurlscheme://”) may no longer work. You may see the following error in the console log …
-canOpenURL: failed for URL: “myurlscheme://” - error: "This app is not allowed to query for scheme myurlscheme”
This is prevent one app arbitrarily calling another app and Apple encourage developers to use their new Universal Links or app extensions instead. This is obviously going to break a lot of existing apps!
I am currently developing a series of children’s book apps that can each be called from a single library app via custom URL Schemes, which all worked fine under iOS8. When I upgraded one of my devices to iOS9 the apps (in beta on TestFlight and complied fro iOS8) still linked to each other but now popped up a dialog box asking the user to confirm the call to the other app was OK. This only happened the first time the call was made and thereafter transferred directly which is a reasonable compromise to the user experience. However, once the apps were recompiled for iOS9 the URL Scheme call failed with the error message above. What my code does if the openURL call returns false (i.e. the app is not already installed on the device) is link to the app store instead. Problem now is the even when the app is installed it links to the app store so the mechanism is broken!
The reason why this still worked with the iOS8 versions is that Apple is allowing up to 50 URL Schemes to be linked so that existing apps are not initially broken. So what’s the solution for new apps? Well the answer lies in a new Plist entry in build.settings.
LSApplicationQueriesSchemes =
{
“myurlscheme1”,
“myurlscheme2”,
“myurlscheme3”,
},
This works for my custom URL Schemes and presumably would also work if you specified another app that is not one of your own.
Happy linking!
Stefan