Universal Links on iOS
Related: iOS App Development, URL Scheme.
Universal Links are a bit more complicated compared to URL Scheme deep links and require backend setup. They allow select specific pages of the website to make the app handle them.
Available: since iOS 9
Website should provide [[Associated Domains Entitlement]] as a [[apple-app-site-association]] file in json format:
{
“applinks”: {
“apps”: [],
“details”: [
{
“appID”: “T5TQ36Q2SQ.com.reddit.production”,
“paths”: [“*”],
}
]
}
}
Applinks
Applinks indicate this is indeed for the Universal Link declaration.
Apps
Apps should be left as an empty array:
“The apps’s key in an apple-app-site-association file must be present and its value must be an empty array).
Details
Details will then contain an array of your apps and the mapping of each subpath to the respective app.
AppID
AppID is a concatenation of your teamID and your app’s bundleID. It should be added for each app.
For eg:
- TeamID is 123456
- bundleID: is com.myApp
- AppID: 123456.com.myApp.
Paths
In the paths field, an array of strings represents expressions of the paths that correspond to this app.
Wildcards
- * is a wildcard for any string,
- ? is a wildcard for any character.
Exclude Paths
If you want to exclude a subpath, just add NOT at the beginning:
[ “/wwdc/news/”, “NOT /videos/wwdc/2010/”, “/videos/wwdc/201?/”]
The order of paths matters. The system evaluates the path in order and will stop when finding a NOT.
Reddit example: https://www.reddit.com/apple-app-site-association
The link must not end in .json, and the request must return a header content-type: application/json.
App Capabilities Configuration
Project settings -> capabilities.
- Associated Domains should be on.
- Add any URL that implements our apple-app-site-association resource, preceded by app links.
- Inside the Domains section, add a applinks:myApp.com.
Comments