iOS deeplinks won't open my app (both with URL types and associated domains)
Asked Answered
A

1

6

I am trying to open my app from a deeplink (say https://hey.hoy/test), but I can't get it working.

I tried both solutions:

Associated domains

enter image description here

URL Types

enter image description here

In both cases, I have tried applinks:hey.hoy but also hey.hoy or https://hey.hoy, but nothing never works.

Thanks for your help

Armalla answered 17/5, 2022 at 15:50 Comment(0)
F
13

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:

  1. 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.
  2. 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.
  3. 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.

  1. 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".

Facelift answered 17/5, 2022 at 17:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.