Setting up iOS Universal Links
Here are some good URLs that might be of assistance:
Follow these steps to setup Universal app linking on the web server. In this example we use Apache2 as our web server but the same rules apply for nginx or IIS.
Below you'll find a template with a few examples:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "<TEAM_DEVELOPER_ID>.<BUNDLE_IDENTIFIER>",
"paths": [ "*" ]
},
{
"appID": "<TEAM_DEVELOPER_ID>.<BUNDLE_IDENTIFIER>",
"paths": [ "/articles/*" ]
},
{
"appID": "<TEAM_DEVELOPER_ID>.<ANOTHER_APP_BUNDLE_IDENTIFIER>",
"paths": ["/blog/*","/articles/*"]
}
]
}
}
PLEASE NOTE!
"apps":
JSON key must be left as an empty array..json
file extension.openssl smime -sign -nodetach
-in "unsigned.json"
-out "apple-app-site-association" -outform DER
-inkey /path/to/server.key
-signer /path/to/server.crt
scp /path/to/apple-app-site-association username@example.com:~/
ssh username@example.com
mv apple-app-site-association /var/www/
The apple-app-association-file needs to be returned with the following Content-Type:
Content-type: "application/pkcs7-mime".
Below you'll find instructions on how to do this for your web server.
/etc/apache2/sites-available/default-ssl
(or equivalent) file to include the <Files>
snippet:<Directory /path/to/root/directory/>
...
<Files apple-app-site-association>
Header set Content-type "application/pkcs7-mime"
</Files>
</Directory>
/etc/nginx/sites-available/ssl.example.com
(or equivalent) file to include the location /apple-app-assocation
snippet:server {
...
location /apple-app-site-association {
default_type application/pkcs7-mime;
}
}
<MyApp>.xcodeproj/<Build target>/Capabilities
and turn on Associated domains.<AppName>.entitlements
file that needs to be included in the project.AppDelegate
methodsmyAppScheme://
, this method will already be implemented.- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
NSURL *url = userActivity.webpageURL;
// handle url
}