How to Query Custom URL Schemes in iOS 9 (Hint: it’s different now.)

This was a new one on me and I discovered it accidentally.

In one of my apps, NineOneOne ~ One-Touch Emergency Dialer, I query for the presence of the Skype app, so that an emergency call can be placed using Skype instead of the phone app.

Why would one want to do this? Well, as it turns out, I wanted users who had an iPad or an iPod Touch to be able to use NineOneOne on those devices without the presence of the phone. The obvious candidates were Skype and Google Voice, and at the time Google did not provide a way to launch Google Voice via custom URL scheme. Therefore Skype was it.

Prior to iOS 9, this process was super easy. Just call UIApplication’s canOpenURL method:

self.skypeEnabled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"skype://"]];

Unfortunately I noticed that this was breaking in iOS 9 and there was a little message in Xcode’s console:

This app is not allowed to query for scheme skype

…and this baffled me since I hadn’t heard of any changes to this API and it seemed like a pretty standard and common function to use.

The New Way
It turns out that, while this method still works in iOS 9, you have to take an extra step beforehand. At about the 10-minute mark in the video for Session number 703 at WWDC 2015, you will find that the presenter shows the new process going forward.

You need to open up your Info.plist file, and add a new record, LSApplicationQueriesSchemes, define it as an array, and then add the schemes that you will be querying in your app to that list:


Once I added that key and the “skype” URL scheme to the array in the Info.plist, the URL scheme querying immediately started to function again!

This strikes me as a way for Apple to keep track of who’s-querying-who’s-app by using the app’s metadata, and also for iOS 9 to deny any URL scheme queries that are not in the list, so we need to now be explicit up-front about which URL schemes we are interested in.