19

The following solution can support universalLink on simulator.

I have an app that support the UniversalLink. User click the supported links in the website, will be navigated to the features in the application.

But It failed to work on the iOS 14 beta 4. Instead of open the the app, it opens a webpage instread.

After research, as I can see from the document here https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_associated-domains enter image description here

Need to update the Service.entitlements to support both iOS 13 and iOS 14

<Key>com.apple.developer.associated-domains</key>
  <array>
    <string>applinks:hosturl</string>
    <string>applinks:hosturl?mode=developer</string>
 </array>

It is working well on the simulator. But I am unable to make it working on the devices. Anyone can help this.

Jin
  • 665
  • 1
  • 7
  • 15

2 Answers2

40

If you want to open the application in a development environment you must:

Step 1: Specify the associated domains

service:fully qualified_domain?mode=alternate mode

ex: applinks:YOUR_DOMAIN?mode=developer

Step 2: Enable Associated Domain Development on device

On the test device, you need to activate the Associated Domain Development setting which is in : Setup -> Developer

Settings

Developer

Senseful
  • 86,719
  • 67
  • 308
  • 465
Alex
  • 511
  • 4
  • 4
2

The format also changed for iOS14 devices. This means that apple-app-site-association should be on both the root folder of you website (for pre iOS9.3 devices if supported) plus on the .well-known folder.

<YOUR_URL>/apple-app-site-association
<YOUR_URL>/.well-known/apple-app-site-association

The new format is this in order to support pre iOS14 and iOS14 devices.

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "<YOUR_APP_ID>",
        "components": [ // iOS14
          {
            "/": "<URL_PATH>",
            "comment": "Matches any URL whose path starts with URL_PATH and instructs the system not to open it as a universal link"
          }
        ],
        "paths": [ // pre iOS14
          "NOT \/api\/*",
          "NOT \/",
          "<URL_PATH>"
        ]
      }
    ]
  }
}

more information on: https://developer.apple.com/documentation/safariservices/supporting_associated_domains

Daniel S.
  • 730
  • 6
  • 14
  • 2
    You don't need to put it in both locations unless you support devices earlier than iOS 9.3 (which I suspect few are). Apple changed the default association location to `/.well-known/` back then, so you can use one file in the well-known folder and just include both paths and components. See: https://developer.apple.com/forums/thread/43342 – Zack Jun 01 '21 at 09:34