Hi I know this question being asked before still I cannot figure out what am doing wrong.
- Added apple-app-site-association file in our server under https://ourserver.com/.well-known/apple-app-site-association
- The file content is as follows
`
{
"applinks":{
"apps":[],
"details":[
{
"appID":"<teamId>.<bundleId>",
"paths":[ "*", "/" ]
}
]
}
}
` 3. Associated Domain is added as capability with
applinks:servername.com
applinks:dev.servername.com
Added code in AppDeletegate.m
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { return [RCTLinkingManager application:application openURL:url options:options]; } - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; }
EDIT 1
Noticed something i tried universal linking in iOS versions 12.4.2 iPhone and it redirected correctly. Where as in iOS version 14 it redirected to our web page. So I updated my apple-app-site-association file as follows
{
"applinks": {
"details": [
{
"appIDs": [
"teamid.bundleid"
],
"components": [
{
"/": "/*",
"comment": "Matches any URL whose path starts with URL_PATH and instructs the system not to open it as a universal link"
},
{
"/": "*",
"comment": "Matches any URL whose path starts with URL_PATH and instructs the system not to open it as a universal link"
}
],
"paths": [
"*",
"/"
]
}
]
}
}
oru web url is validated in this link
All the testing is done in real devices.
EDIT 2
All below is tested in Simulator - iPhone 11 Pro iOS 14.4
Tested the same in a simulator with developer mode
applinks:servername.com?mode=developer applinks:dev.servername.com?mode=developer
it opened correctly in SIMUALTOR
then i misspelled our server name and clicked from iMessages it redirected to Safari in SIMULATOR -
I tried again with correct server name after clearing Safari history and cache - STILL IT REDIRECTES TO BROWSER NOT APP
EDIT 3
On Simulator
Went through this link and saw about Smart App banner since i couldn't find anything like that. After searching found this SO Post and tried Settings - Safari - Advanced - Website Data - In the page showed my domain name - Clear Website Data. Tried again on Simulator and app opened correctly
On iPhone with release adhoc build
On Real Device did the same Settings - Safari - Advanced - Website Data - In the page showed my domain name - Clear Website Data but it didn't work. Still it opens the browser in app
EDIT 4
the AASA file in EDIT 2 make the redirection fail in iOS version 12.4.2. Hence updated it like this
{
"applinks":{
"apps":[
],
"details":[
{
"appID":"teamid.bundleid",
"paths":[
"*",
"/"
],
"appIDs":[
"teamed.bundleid"
],
"components":[
{
"/":"/*"
},
{
"/":"*"
}
]
}
]
}
}
After updating to this redirects to app in version 12.4.2 but fails in 14 and above versions. Modified AASA file after going through this link
Any Help is Appreciated
Thanks in advance
I was having the same issue and saw above @suja haven't resolved it yet so I thought to post the answer here.
First we need to double-check our
<teamID>.<bundleID>pattern. Because if our association file doesn't recognize this if it's wrong (even though if we got all other steps correctly).I found this useful official link and saw this video carefully. Also, the video slides can be seen here in PDF
Actually, they've updated the contents regarding association file, like
appID: string_valuekey now turns intoappIDs: array_of_stringspathskey has now been replaced bycomponentsmode=developerat the end of the matching URL in the Association Domains capability in XCode.http://(like if you are launching your website locally usinglocalhost:PORTthen you should use some external service to make your localhost available as a public link). In my case, I did use ngrok to mock my localhost ashttps://, also don't forget to allow that ngrok URL in CORS policy, if web services (APIs) are being called from your web pages.apple-app-site-associationmust be in a public folder of your website under subdirectory.well-knownNow combine all steps. I was having the same issue since yesterday then I found the above links from the official Apple site to get this done and to understand how exactly Universal link works.
Most importantly, if you are testing on Simulator, then please make sure that from your Apple developer Account that your development
appID.bundleIDshould be exact in the association file.below is my association file as an example
And for production, don't forget to add the production URLs in association domains capability, as well as
PROD_appID.PROD_bundleIDinapple-app-site-associationfile. Remember this file should be accessible by apple atThat's it, and further to play around with query parameters as well as dynamic paths, I would suggest seeing the above PDF link and especially the video on the official Apple site!