You need to having a server running online. To securely associate your iOS app with a server, Apple requires that you make available a configuration file, called apple-app-site-association
. This is a JSON
file which describes the domain and supported routes.
The apple-app-site-association
file needs to be accessible via HTTPS
, without any redirects, at https://{domain}/apple-app-site-association.
The file looks like this:
{
"applinks": {
"apps": [ ],
"details": [
{
"appID": "{app_prefix}.{app_identifier}",
"paths": [ "/path/to/content", "/path/to/other/*", "NOT /path/to/exclude" ]
},
{
"appID": "TeamID.BundleID2",
"paths": [ "*" ]
}
]
}
}
NOTE - Don’t append .json
to the apple-app-site-association
filename.
The keys are as follows:
apps
: Should have an empty array as its value, and it must be present. This is how Apple wants it.
details
: Is an array of dictionaries, one for each iOS app supported by the website. Each dictionary contains information about the app, the team and bundle IDs.
There are 3 ways to define paths:
Static
: The entire supported path is hardcoded to identify a specific link, e.g. /static/terms
Wildcards
: A * can be used to match dynamic paths, e.g. /books/* can matches the path to any author’s page. ? inside specific path components, e.g. books/1? can be used to match any books whose ID starts with 1.
Exclusions
: Prepending a path with NOT excludes that path from being matched.
The order in which the paths are mentioned in the array is important. Earlier indices have higher priority. Once a path matches, the evaluation stops, and other paths ignored. Each path is case-sensitive.
#Website Code
The website code can be found gh-pages branch on https://github.com/vineetchoudhary/iOS-Universal-Links/tree/gh-pages