Deeplinks with custom protocols aren't recommended because they are insecure. I'd strongly recommend implementing universal links (like https://example.com/) if you can.
In order to make the universal links open in your app, you'll need the following:
- Declare an associated domain in Xcode on Signing and Capabilities tab (as you've already done). This will add a new entitlement to your app.
- If you have automatic code signing turned off, you'll need to manually add the Associated Domains capability to your AppID at the developer portal (https://developer.apple.com/account/) and regenerate provisioning profiles. Otherwise Xcode should do it all for you.
- Create an
apple-app-site-association
file (exactly that name, no extension) and put it on you website either at the root or in the .well-known
directory.
The minimal version of this file would look like this:
{
"applinks": {
"apps": [],
"defaults": { "percentEncoded": false },
"details": [
{
"appID": "AAAA0XXXX.com.example.YourApp",
"paths": [ "*" ],
"appIDs": ["AAAA0XXXX.com.example.YourApp"],
"components": [
{ "/": "/*" }
]
}
]
}
}
This file should be served at one of the URLs (on your domain, not on example.com of course):
By putting this file on your website you prove that you are the owner of the domain and no other app will be able to hijack your universal links.
- You might need to reinstall the app on the device you're testing the links on so that iOS on that device would fetch the
apple-app-site-association
file. It might take some time for the links to start working because the device doesn't fetch the file directly. Apple's infrastructure fetches it and caches in their CDN.
For more information, consider taking a look at some WWDC sessions, search by "Universal Links".