Universal links not working IOS

I have had universal links setup on Android and working fine for some time. This year I began to do the IOS app and I followed the steps:

  1. Deploy Apple site association file and confirmed as working with the testing tool.
  2. Enabled associated links in my developer profile
  3. Added associated domain to signing and capabilities in XCode

The link just opens Safari every time instead of launching the app. I have tried everything I could find on every thread, most of which are out of date.

I’m running the latest packages of Ionic, Capacitor, Capacitor IOS etc. I can see that appUrlOpen isn’t firing but I believe that’s just a symptom of universal links not being properly registered in the XCode build since it’s my oauth POST request redirect that isn’t being captured.

Does anyone have a simple explanation for why this might not work ?

For anyone else who has trouble with this , here’s a checklist to perform if you have already done the above and the universal link still doesn’t work:

  1. Ensure that your entitlements file (App.entitlements) has been included in the build:

If there is no checkbox ticked under Target Membership go to step 2.

  1. On your target app, go to build phases and manually add the entitlements file there.

  1. Try and launch the app from the link

xcrun simctl openurl booted https://yoururl.com

Note: the link will not work without a valid HTTPS URL and it will also not work with any port number after it. I found this out the hard way!

I hope that this helps someone in the future.

Re: oauth redirects, the best way to do this is to use a custom URL scheme and redirect using capacitor’s inAppbrowser. Otherwise you will keep getting redirected to Safari instead of back to the app with the oauth code.