iosdeep-linkingios-universal-links

Universal Link configured but not working


I’ve done everything that appears to be required to get Apple’s Deep Universal Links working, but when I test the URL from Notes or dragging the link from Air Drop to a device running my app that supports the universal link, it is opened in Safari and the delegate method is not called:

(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    NSLog(@"application openURL: %@", url);
    return true;
}

I have added my domain to the App Transport Security exception (in the Signing & Capabilities tab):

applinks:MyDomain.com?mode=developer

(MyDomain.com is a working domain name with https support)

enter image description here

I have ‘Associated Domains’ enabled for my app identifier and using the App ID Prefix shown for the app identifier used by my app Bundle Identifier.

My apple-app-site-association file:

{
  "applinks": {
      "details": [
           {
             "appIDs": [ "MyAppIdentifer.MyBundleIdentifer" ],
             "paths": [
                "*"
             ],
             "components": [
               {"/": "/*"}
             ]
           }
       ]
   }
}

The apple-app-site-association file is installed and visible were Apple requires it:

https://<fully qualified domain>/.well-known/apple-app-site-association

And I validated apple-app-site-association using my app identifier, bundle identifier and my domain name here https://branch.io/resources/aasa-validator/

enter image description here

When I check Apple’s CDN, a stale copy of my apple-app-site-association is shown (that is missing the App Identifier):

curl https://app-site-association.cdn-apple.com/a/v1/MyDomain.com

{
  "applinks": {
      "details": [
           {
             "appIDs": [ "MyBundleIdentifer" ],
             "paths": [
                "*"
             ],
             "components": [
               {"/": "/*"}
             ]
           }
       ]
   }
}

But since I’m using the applinks mode=developer flag, and running the app in debug mode, it should be getting the apple-app-site-association direct from my domain name. Anyways, it shows that my apple-app-site-association file is visible to Apple's server.


Solution

  • You need to add your domain to the "associated domains" entitlement, not the ATS exception domains entitlement.

    https://developer.apple.com/documentation/xcode/supporting-associated-domains