Asked  7 Months ago    Answers:  5   Viewed   62 times

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?

 Answers

18

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.

Tuesday, June 1, 2021
 
francadaval
answered 7 Months ago
65

In iOS 9.1 and lower, go to Settings - General - Profiles - tap on your Profile - tap on Trust button.

In iOS 9.2+ & iOS 11+ go to: Settings - General - Profiles & Device Management - tap on your Profile - tap on Trust button.

In iOS 10+, go to: Settings - General - Device Management - tap on your Profile - tap on Trust button.

Wednesday, June 2, 2021
 
HexaGridBrain
answered 7 Months ago
53

The previous answer is a partial implementation of Universal Links that is missing critical details and doesn't include a fallback to the App Store.

First, you can no longer set iframe src in order to trigger a URI scheme. You've correctly identified that issue. As you noted, you can, however, still set window.location = 'custom-protocol://my-app';. So if you know that a user has your app because you've previously opened their app from the browser and have a cookie stored that can be looked up on your backend, you can still safely fire custom-protocol://.

Second, you can detect the user agent string using navigator.userAgent. Pre-iOS 9 you can still use the iframe to fire a URI scheme, then fallback after a timeout. On iOS 9, you can choose whether to fire the URI scheme or not based on cookies, then take the user to the App Store. I work on this at Branch and making use of cookies to recall whether a user likely has the app is something we've implemented. Feel free to reach out if you have more questions about that, or make use of our solution directly.


Implementing Universal Links is not quite as simple as the other answer describes. In reality, there is considerably more complexity. Here's a complete list of steps (I've helped several apps integrate in recent weeks using these steps):

1. Configure your app to register approved domains

i. Registered your app at developer.apple.com if you haven't

ii. Enable ‘Associated Domains’ on your app identifier on developer.apple.com

iii. Enable ‘Associated Domain’ on in your Xcode project

entitlements

iv. Add the proper domain entitlement, applinks:yourdomain.com, in your app

applinks

2. Configure your website to host the ‘apple-app-site-association’ file

i. Buy a domain name or pick from your existing

ii. Acquire SSL certification for the domain name (you can use CloudFlare for this!)

iii. Create structured ‘apple-app-site-association’ JSON file

{
   "applinks": {
       "apps": [ ],
       "details": {
           "TEAM-IDENTIFIER.YOUR.BUNDLE.IDENTIFIER": {
               "paths": [
                   "*"
               ]
           }
       }
   }
}

iv. Sign the JSON file with the SSL certification


v. Configure the file server

The apple-app-site-association file: - must be sent with the header ‘application/pkcs7-mime’ - must be sent from the endpoint youdomain.com/apple-app-site-association - must return a 200 http code.

Example Express+Node:

var aasa = fs.readFileSync(__dirname + '/static/apple-app-site-association');
app.get('/apple-app-site-association', function(req, res, next) {
     res.set('Content-Type', 'application/pkcs7-mime');
     res.status(200).send(aasa);
});

credit: borrowed liberally from this blog post

Saturday, July 31, 2021
 
Yigang Wu
answered 5 Months ago
68

In iOS 9 you must whitelist any URL schemes your App wants to query in Info.plist under the LSApplicationQueriesSchemes key (an array of strings):

For example:

enter image description here

So in your case, instead of fb and twitter you will have to specify whatsapp.

Note that this mechanism only applies to canOpenURL and not openURL. You do not need to have a scheme listed in Info.plist to be able to open it with openURL. Hope that helps.

Wednesday, August 11, 2021
 
ala
answered 4 Months ago
ala
18

There are new icons for the iPad Pro and new splash screens as well. For the iPad pro you will now need an App Icon 167x167 and 2 splash screens measuring:

2048 x 2732 (portrait)
2732 x 2048 (landscape)

They just updated the doc at: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html

Saturday, October 23, 2021
 
user9824674
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share