I recently posted an article on URL schemes, detailing the benefits and restrictions of this approach for deep linking. Apple introduced Universal Links with the release of iOS9, addressing URL scheme’s shortfalls, but introducing some new challenges.
Universal Links: The Latest Approach
Apple’s Universal Links is the successor to URL scheme deep linking, available in iOS9+. Universal Links is linking web page addresses which can open an app. Essentially, this means a Universal Link uses http or https as it’s scheme, and you must own the linked web page (the URL’s authority). As a result, Universal Links are also guaranteed to be unique and are automatically recognized as links in other apps.
In addition to peace of mind, the significance of a unique link is that iOS is able to launch your app with confidence: the user will not be prompted when opening a Universal Link. This makes the user experience seamless. These are major advantages to Universal Links when compared to the old method, URL schemes.
As the web page needs confirm it’s association with an app, this introduces some requirements. For iOS to detect if a listed web page is associated, on app install it will check for a file hosted at a specific location on the domain. This is a one time operation and is only repeated if the app is reinstalled.
The file in question is apple-app-site-association. It must be accessed over SSL as https://<domain>/.well-known/apple-app-site-association on iOS 9.3 and https://<domain>/apple-app-site-association prior to that. For example, on my site I would host at https://www.bradkratky.ca/.well-known/apple-app-site-association. The file must not have an extension, but the MIME type must be application/json. The file access is described briefly in Apple’s docs:
After you create the apple-app-site-association file, upload it to the root of your HTTPS web server or to the .well-known subdirectory. The file needs to be accessible via HTTPS—without any redirects—at https://
/apple-app-site-association or https:// /.well-known/apple-app-site-association.
For the hobbyist, SSL certification can be a limitation since hosting and gaining certification can be expensive. Fortunately, the certification for a limited number of domains can be acquired for free on sites such as startSSL.
A note on Universal Links that can be easily overlooked is it’s availability from other apps. Apple’s documentation states:
If you instantiate a SFSafariViewController, WKWebView, or UIWebView object to handle a universal link, iOS opens your website in Safari instead of opening your app. However, if the user taps a universal link from within an embedded
UIWebViewobject, iOS opens your app.
This means if you try and open the link from messaging or sharing apps that implement a browser in that way, your Universal Links will not work. Be sure to test deep linking if you’re hoping to redirect from specific sources.
I hope you’ve enjoyed this overview of the features and limitations of Apple’s official deep linking options. Universal links are great for giving users direct access to your content, but it’s important to plan the approach. Happy linking!