Apple association file fetched in development but not in TestFlight and App Store

Universal links work perfectly fine in development, but once I sign the applications and deploy them to TestFlight and App Store, it looks like the apple-app-site-association is not fetched and therefore the app isn't registered for oppening the universal links.
1. /.well-known/apple-app-site-association file:

{
  "applinks": {
  "apps": [],
  "details": [{
  "appID": "myteamid.com.mycompany.appName",
  "paths": ["*"]
  }]
  }
}

The server part looks OK, since it is successfuly fetched whenever I run the app via the cable on my phone.

App Search API Validation tool returns this for Link to application:

Action required

Could not extract required information for Universal Links. Learn how to implement the recommended Universal Links.

  • Error no apps with domain entitlements
  • The entitlement data used to verify deep link dual authentication is from the current released version of your app. This data may take 48 hours to update.

2) Capabilities:

Associated domains - ON with Domain list of:

applinks: link.mycompany.com


Other things I have turned on are: Push Notifications and Background Modes.
3) Provisioning profile:
I created a new one after adding the Universal links and Push notifications and it includes:
Capabilities:

Associated Domains,

Game Center,

In-App Purchase,

Keychain Sharing,

Push Notifications.

Entitlements:

get-task-allow,

app-enviroment,

com.apple.developer.associated-domains,

com.apple.developer.team-identifier,

application-identifier,

beta-reports-active,

keychain-access-groups

4) While installing the app, it behaves different in test flight then it does when loading via cable:
a) Via cable I can see the successfull http request for the apple-app-site-association file and finally form the process swcd:

"Added service 'applinks', appID 'myteamid.com.mycompany.appName', domain 'link.mycompany.com' "

b) Test flight - when installing there is no sign of http request and the following line is shown if I previously had the app installed via cable:

"Removed service 'applinks', app ID 'myteamid.com.mycompany.appName', domain 'link.mycompany.com' (removed domain) "


This of course results in the fact that whenever I install the app via TestFlight or Describution, the Universal links do not work.

Any ideas where it goes wrong?

Replies

Hi Darja,


The most likely cause is that you are using a different provisioning profile for distribution, but that distribution profile does not have the capabilities enabled that you need. Please see:

https://developer.apple.com/library/content/qa/qa1798/_index.html

This document describes how you can check the entitlements in the actual .app file that is uploaded, and in the embedded provisioning profile, and also contains troubleshooting steps.


Additionally, please keep in mind that the App Search API Validation Tool can only validate apps that are already available for sale on the app store.


I hope this is helpful.


musashi

I checked the capabilities of the provisioning profile for distribution and it seems all that are reqired are there - and the right profile is used in the signed app. I exported the app with the "Sign and export without uploading" option. In the embedded.mobileprovision file I checked for the used distribution profile and it matches the profile with capabilities and entitlements written in my previous post.
Any other suggestions?

I finally got to the bottom of this with help of Apple Developer Technical Support. In my (cordova) project folder there are two files:


Entitlements-Debug.plist

Entitlements-Release.plist


When I add the value applinks:mywebpage.com to Capabilities->Associated domains->Domains, the Entitlements-Debug.plist got the lines:


<key>com.apple.developer.associated-domains</key>

<array>

<string>applinks:mywebpage.com</string>=

</array>


BUT the Entitlements-Release.plist did not change. What I did to solve the issue is to copy-paste the generated lines form the Entitlements-Debug.plist. After this, I did the exact same Archive and upload process as before and everything worked fine.