Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 9 not opening Instagram app with URL SCHEME

People also ask

How do I get iOS URL scheme?

First, you have to download the IPA file for the app, which requires macOS and Apple Configurator 2. When you finally find the IPA, you have to turn it into a ZIP file, show the contents of the app package, then hunt for the specific PLIST file that contains the scheme names.


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.


As said above, you want to add a key in the info plist, here is the list for most social networks

<key>LSApplicationQueriesSchemes</key>
    <array>
     <string>fb</string>
     <string>fbapi</string>
     <string>fbauth2</string>
     <string>fbshareextension</string>
     <string>fb-messenger-api</string>
     <string>twitter</string>
     <string>viber</string>
     <string>whatsapp</string>
     <string>wechat</string>
     <string>line</string>
     <string>instagram</string>
     <string> instagram-stories</string>
     <string>kakaotalk</string>
     <string>mqq</string>
     <string>vk</string>
     <string>comgooglemaps</string>
     <string>googlephotos</string>
     <string>ha</string>
     <string>yammer</string>
    </array>

* The first 3 match Facebook (FBSDK 4.6): fbapi, fbauth2, fbshareextension. "Ha" is for snapchat


This is a new security feature of iOS 9. Watch WWDC 2015 Session 703 for more information.

Any app built with SDK 9 needs to provide a LSApplicationQueriesSchemes entry in its plist file, declaring which schemes it attempts to query.

<key>LSApplicationQueriesSchemes</key>
<array>
 <string>urlscheme</string>
 <string>urlscheme2</string>
 <string>urlscheme3</string>
 <string>urlscheme4</string>
</array> 

Assuming two apps TestA and TestB. TestB wants to query if TestA is installed. "TestA" defines the following URL scheme in its info.plist file:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>testA</string>
        </array>
    </dict>
</array>

The second app "TestB" tries to find out if "TestA" is installed by calling:

[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"TestA://"]];

But this will normally return NO in iOS9 because "TestA" needs to be added to the LSApplicationQueriesSchemes entry in TestB's info.plist file. This is done by adding the following code to TestB's info.plist file:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>TestA</string>
</array>

A working implementation can be found here: https://github.com/gatzsche/LSApplicationQueriesSchemes-Working-Example