Issue #901

Apple app site association

https://com.example/.well-known/apple-app-site-association

Supporting Associated Domains New format from iOS 13 Can also remove components section if we match all URLs

{
  "applinks": {
      "details": [
           {
             "appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
             "components": [
               {
                  "/": "/*",
                  "comment": "Match all URLs"
               }
           }
       ]
   },
}

Application Identifier Prefix

appID is in form <Application Identifier Prefix>.<Bundle Identifier> For Application Identifier Prefix , you can find it in https://developer.apple.com/account/resources/identifiers App Id Prefix

Usually, App Id Prefix is the same as Team Id, but it can be different.

Read Managing Multiple App ID Prefixes

An App ID prefix is a unique identifier used to group a collection of apps so they can share keychain and UIPasteboard data. iOS has two different types of App ID prefixes: a new kind that is your Team ID and an older-style that uses a ten digit alphanumeric string instead of your Team ID. If you have been writing apps for a long time, you may have a number of the older-style prefixes in place, but that would only be the case if you have created additional prefixes yourself (this was only possible prior to the introduction of iCloud in June 2011). Newer app developers who joined the developer program after June 2011 will only have a single App ID prefix associated with their account

Apple hosted file

Starting with macOS 11 and iOS 14, apps no longer send requests for apple-app-site-association files directly to your web server. Instead, they send these requests to an Apple-managed content delivery network (CDN) dedicated to associated domains.

Apple’s Content Delivery Network requests the apple-app-site-association file for your domain within 24 hours. Devices check for updates approximately once per week after app installation.

If we’re not using developer mode, we may need to wait for a day for Apple CDN to cache our apple-app-site-association file

Troubleshoot

In Xcode, specifying association domains under Signing & Capabilities -> Associated Domains

While you’re developing your app, if your web server is unreachable from the public internet, you can use the alternate mode feature to bypass the CDN and connect directly to your private domain.

There are 3 modes

  • applinks:com.example?mode=developer
  • applinks:com.example?mode= managed
  • applinks:com.example?mode=developer+ managed

On iOS Device, go to Settings > Developer -> enable Associated Domain Development

To handle universal link, in UISceneDelegate

optional func scene(
    _ scene: UIScene,
    continue userActivity: NSUserActivity
)

Console

To troubleshoot for potential universal link error, check Console app and filter for swcd

To enable development mode, go to device or simulator Settings -> Developer -> Associated Domains Development. You should disable this to reach for Apple CDN cache of the association file.

Check Apple CDN

To check if the domain has an association file accessible, check App Search API Validation Tool

We can make a GET request to https://app-site-association.cdn-apple.com/a/v1/example.com to test

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

Other

There can be cases iOS caches the association file, we need to delete the app and install again to check

Read more