问题
I don't get applinks: in iOS not working, whenever I open a link like https://www.example.com/something
on my iOS 9 device, it gets opened in Safari.
I'm running the app via debug provisioning profile, on my server there is a file called apple-app-site-association
.
There are two different formats I found:
{
"applinks": {
"apps": [],
"details": {
"AB1CDEFGHI.com.mydomain.myapp": {
"paths": ["*"]
}
}
}
}
as well as
{
"applinks": {
"apps": [],
"details": [
{
"appID": "AB1CDEFGHI.com.mydomain.myapp",
"paths": [ "*" ]
}
]
}
}
so that's the first thing I'm not sure which one to use.
The second is the 'AB1CDEFGHI'-part; the "Team-ID" of the app? Is it the stuff that's included in the appid or really the team id of the developer account?
So is it this one completely blacked out?
or is it this one here (again, the part completely blacked out)?
EDIT
I just tried setting it up in another app, worked the first time without any problems - really don't know the difference.
- AppId includes entitlements
- apple-app-site-association is the same
- associated domains added in app
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
implemented
what could I probably be missing?
EDIT 2
I just saw a difference in both apps (the one that's working and the one that doesn't): the working app has an AppId in the developer portal with a prefix matching the TeamID, the not-working app has a prefix which is different from the TeamID. I already tried using the prefix from the AppID in the apple-association-file, but it doesn't work either...
回答1:
I spent a good amount of time trying to fix this issue today. It finally came down to the setup of my SSL certificate. Things you should check for:
1) In the device console in XCode (Window - Devices, select your iphone, and open the dialog by clicking the triangle in the bottom left of the main view), do you see "Rejecting URL for auth method 'NSURLAuthenticationMethodServerTrust': kAuthenticationError"? If so, this means that your SSL certificate is most likely not properly setup.
Use https://cryptoreport.websecurity.symantec.com/checker/views/certCheck.jsp to make sure there are no SSL cert errors with your website.
Also if you were bypassing TLS 1.2 in your infoplist you may have to remove those keys as well.
2) Make sure to turn on Associated Domains at developer.apple.com for the correct App ID
3) Make sure to add the appropriate applinks to the Associated Domains within the Project Target of XCode. Also make sure the entitlements file got added to your project. I read somewhere that this file didn't get generated for someone and that may be your problem as well.
回答2:
I found the error on my side: I had to use the App IDs prefix in the apple-app-site-association
file which was different than the TeamID for this specific app.
I didn't find a documentation where it says something other than TeamID, that's why it took me so long. Only after I compared with two apps I found the only difference and now it's working.
回答3:
The behavior of the device/native app making a request to the https:///apple-app-site-association endpoint was unpredictable. But I did notice that adding/removing "applinks:" from the entitlements file did seem to trigger a request. Proxy your device through CharlesProxy and you can see the request being made (albeit, just the domain, not the full SSL request because of certificate pinning) but it is better than nothing.
来源:https://stackoverflow.com/questions/33731371/applinks-in-ios-9-not-working