Legolas Legolas - 5 months ago 96x
iOS Question

iOS9: Universal Links does not work

So I followed the tutorial and exactly use the same values as the one provided.

The Apple Association file is also ready in the link directory:

Everything seems to be setup on this side.

I've added the entitlements, updated the provisioning profile, and everything's setup.

When I run the app on my device, and open the link http://WEB_PAGE:PORT_NUMBER, this always opens Safari.

I even have breakpoints in the following methods:

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler

But zilch.

Has anyone perfected this? Is there something I missed out?


There are a few possible issues.

  1. Try pasting your domain into this link validator and make sure there are no issues: (credit to ShortStuffSushi -- see repo)

  2. iOS logs an error message in the system logs if you don't have TLS set up properly on the domain specified in your entitlements. It's buried in the OS logs, not application logs. The error message will look like Sep 21 14:27:01 Derricks-iPhone swcd[2044] <Notice>: 2015-09-21 02:27:01.878907 PM [SWC] ### Rejecting URL '' for auth method 'NSURLAuthenticationMethodServerTrust': -6754/0xFFFFE59E kAuthenticationErr. Error message pulled from here, quick (incomplete) instructions on using CloudFlare for TLS here.

  3. In my personal testing, clicking/typing in a link in Safari has never once opened the app directly. Clicking from other apps (iMessage, Mail, Slack, etc.) has worked. Others have reported that clicking links in Google search results have opened the app directly.

  4. Note that if a Universal Link succeeds in opening your app and then you click through to Safari (by tapping your site in the top right corner of the nav bar in app), then iOS stops opening the app when you visit that URL. Then in Safari, you can pull down to reveal a banner at the top of the page with "Open". I wasted a lot of time on this. Note that clicking through to the site => disabling UL seems path specific, based on the paths you specify in the apple-app-site-assocation file. So if you have separate routes,* and*, if you click* and it opens your app directly, you then have the option in the top right corner of the app to click through to*. If you do that, subsequent visits to* will open in browser, not app. However,* should be unaffected and still open your app directly.

Let me know if you discover what the issue is. I'm personally very curious about how Universal Links work and what edge cases exist. Good luck.