问题
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,
List item
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:
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' "
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?
回答1:
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.
来源:https://stackoverflow.com/questions/52735578/apple-association-file-fetched-in-development-but-not-in-testflight-and-app-stor