Search code examples
iosswiftxcodecocoa-touchios9

iOS 9 not opening Instagram app with URL SCHEME


The following URL opens on iOS 8.3 and lower, but it does not work and iOS 9

let instagramURL = NSURL(string: "instagram://app")

Why won't the URL open?


Solution

  • iOS 9 has made a small change to the handling of URL scheme. You must whitelist the url's that your app will call out to using the LSApplicationQueriesSchemes key in your Info.plist.

    Please see post here: http://awkwardhare.com/post/121196006730/quick-take-on-ios-9-url-scheme-changes

    The main conclusion is that:

    If you call the “canOpenURL” method on a URL that is not in your whitelist, it will return “NO”, even if there is an app installed that has registered to handle this scheme. A “This app is not allowed to query for scheme xxx” syslog entry will appear.

    If you call the “openURL” method on a URL that is not in your whitelist, it will fail silently. A “This app is not allowed to query for scheme xxx” syslog entry will appear.

    The author also speculates that this is a bug with the OS and Apple will fix this in a subsequent release.