iOS 9.2 Deep Linking Guide: Transitioning to Universal Links

When iOS 9.2 was released on Dec 8th, thousands of app developers suddenly realized their app experience was broken. A small change in Safari’s handling of deep links resulted in many sleepless nights for the app community that was struggling to prepare for the holiday shutdown. It was an untimely yet inevitable change.

We saw this coming in the iOS 9.2 beta but were hopeful that our Apple radars (bug reports) and influential partners could motivate Apple to resolve it before release. Unfortunately for iOS developers, it was not to be. Apple’s response to our concerns made perfectly clear what they wanted everyone to do: adopt Universal Links.

AppleiOS9.2Response.png

So be it.

AppleiOS9.2.png

What’s New in iOS 9.2

A change was made in Safari to make the ‘Open App’ modal a Javascript-non-blocking modal. This means that URI schemes cannot be used to open the app directly from Safari. They still work, in that they still open up the app, however if the app is not installed, the user is left with an ugly error message.

This is a significant change to the traditional way you would handle routing users who already have your app installed. Previously, you would open up the app directly from Safari when a user clicked on your link or visited your website. No more.

Upgrading to Support Universal Links

Fortunately, there is hope. Although it’s not perfect, Apple launched Universal Links in iOS 9.0, which moves the app routing into the OS so that developers don’t need to worry about doing the routing in Javascript. (See our original post on setting up Universal Links).

Receiving Universal Link URL in the App

URI schemes received the deep link URL through openUrl in the App Delegate. Universal Links receive their data via a different code path: continueUserActivity. This new delegate method is used for a number of app transitions, ranging from Spotlight to Universal Links, and will likely see a couple more use cases introduced in future OS versions.

Below is a snippet of code that you can use to retrieve the full Universal Link URL that opened the app.

Warning: Don’t go ripping out your URI scheme code just yet.

Despite Apple’s aggressive move towards Universal Links, there are still a lot of edge cases which Universal Links does not support. See them below.

Using Your Old URI Paths

As you’re reading, you’re probably wondering if you can use your old URI schemes and deep link routing. Let’s say that you previously had all of your routing in a method in the App Delegate named handleRouting. You can simply grab the webpageUrl from the user activity and pass it to handle routing like so:

The URLs might be different from your traditional URI schemes, so you just need to have that logic split out in the handleRouting call.

Universal Links Still Don’t Work Everywhere

Unfortunately, Universal Links are not supported on a lot of the browsers and apps that people will be clicking your links from. You can see a list that we’ve accumulated below.

AppleiOS9.2AppBrowserUniversalLinks.png

Not working means that these apps do not respect Universal Links. Every single time you click a Universal Link in one of these apps, the in-app browser will open and the web page will load. Make sure you still employ you URI scheme based deep linking here or your users will be taken to the website even if they have the app installed.

Works conditionally means that there are certain circumstances where the link will behave as a Universal Link, and others where it will not. The following circumstances for ‘clicking’ a link do not respect the Universal-ness of a link:

  • Pasting in a Universal Link to the browser bar
  • Clicking a Universal Link on a web page with the same domain as the link
Branch Handles Both URI Schemes and Universal Links For You

As you can tell, there are a lot of edge cases when it comes to using Universal Links in production. If you don’t want to have to worry about upgrading your linking infrastructure every time there is a change, Branch will handle all of this for you.

In addition to the benefits of Universal Links, when you use Branch you get deep linking through install, attribution, and analytics from a robust service that powers thousands of apps. 

For more information on Universal Links, check out our developer portal. If you’d like to check that your domain is properly configured for Universal Links, try our Universal Links Validator.

Don’t be left in the dark. Sign up today.