iOS:Debuging universal links - ios

I'm trying to implement universal links but for some reason when I load link from the domain I'm trying to redirect to my app is not working. Here is my apple-app-site-association file:
{
"applinks": {
"apps": ["44ABCDFG.com.myTeam.MyApp"],
"details": [{
"appID": "44ABCDFG.com.myTeam.MyApp",
"paths": ["*"]
}]
}
}
I add the domain in the Associated Domains:
Here is my implantation on app:
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler{
NSLog(#"universal links are working!!!");
return true;
}
The links are http but per documentation it shouldn't be a issue. Also per documentation the apple-app-site-association is not necessary to be signed with SSL certificate.
I use apple validation tool and I'm getting this error: Error cannot fetch app site association
Any of you knows what I'm doing wrong or what can I do to make this work?
I'll really appreciate your help.

According to official document, https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
The apps key in an apple-app-site-association file must be present and its value must be an empty array, as shown in Listing 6-1.

Related

iOS Universal link not working in react-native iOS

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_value key now turns into appIDs: array_of_strings
the paths key has now been replaced by components
If you want to test in Simulator during development, then you should use a query parameter mode=developer at the end of the matching URL in the Association Domains capability in XCode.
You cannot use http:// (like if you are launching your website locally using localhost:PORT then 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 as https://, 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-association must be in a public folder of your website under subdirectory .well-known
Now 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.bundleID should be exact in the association file.
below is my association file as an example
{
"applinks": {
"details": [
{
"appIDs": [
"YOUR_PRODUCTION_TEAM_ID.com.yourapp_bundleID",
"YOUR_DEV_TEAM_ID.com.yourapp_bundleID.dev"
],
"components": [
{
"/": "*",
"comment": "Matches any URLs"
}
]
}
]
}
}
And for production, don't forget to add the production URLs in association domains capability, as well as PROD_appID.PROD_bundleID in apple-app-site-association file. Remember this file should be accessible by apple at
https://your-web.com/.well-known/apple-app-site-association
That'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!
Try replacing "appID":".bundleid" with "appID":".bundleid" in your aasa file.

Universal link does not work. Link validator tool displays error:Error no apps associated with url

I followed all the steps for adding universal link support for an app. But the option to open the app is never displayed.
The server hosts apple-app-site-association file with the following contents:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "teamID.bundleID'",
"paths": [ "/ios/meetings"]
}
]
}
}
Device logs for when app is installed:
swcd(CoreUtils)[216] : Completing request for 'https://example.com/.well-known/apple-app-site-association', status 0/0x0 noErr
swcd(CoreUtils)[216] : Updated app ID 'teamID.bundleID', domain '*.example.com', flags 0x0 < > -> 0x2 < SiteApproved > on check
Hitting URL: https://example.com/ through apps like mail, messages, notes, and safari always opens the link in the browser.
Link validator tool displays status passed but the section "Link to Application" displays an error: Error no apps associated with URL.
Can anyone tell me if I am missing anything?
Thanks in advance.
Try this.
1 set paths to ["*", "/"]
and
2 goto Project-->Targets-->Capabilities-->Associated Domain "ON"

Universal Link open URL after subdomain

I am working on universal link. I had some urls to open in my application.
I had added portal.xyz.com in associated domains.
Problem : My application opens on https://portal.xyz.com/. I want to continue this URL to browser. Just want to open URL that having start path https://portal.xyz.com/da/notification**.
How can I do this?
Please keep same associated domain in your project and you need to handle this case from apple-app-site-association file that you have uploaded in server,
{
"applinks": {
"apps": [],
"details": [
{
"appID": "9JA89QQLNQ.portal.xyz.com"//keep your Apple Id of you application,
"paths": [ "/da/notification/*"]
}
]
}
}
Ref: https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html
Hope it will be helpful.

How to restrict all other paths except one for Universal link in iOS to open app using URL

I am using Unviversal link in iOS application.
I am referring Apple doc: https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html
I want to open app for only one path. example domain is https://example.com and paths are /a, /b, and so on. I want to give access to only '/b' path.
How do I do it?
Universal Links operate on an opt-in basis for URLs. In other words, if you don't explicitly specify a path in the apple-app-site-association file (either by literal string or wildcard matching), it won't be used.
Using Apple's example as a basis:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "9JA89QQLNQ.com.apple.wwdc",
"paths": [ "/b"]
}
]
}
}
Identify an area that should not be handled by adding “NOT ” (including a space after the T) to the beginning of the path string. For example, you Want to  prevent to handle the /videos/samples/2010/* area of the website then the paths array as shown here:
"paths": [ "/videos/collections/*", "NOT /videos/samples/2010/*", "/videos/samples/201?/*"]

The apple-app-site-association file format error

*I have error message from API Validation Tool from Apple*
**The apple-app-site-association file was found but it doesn’t follow the required format. Learn how to format the apple-app-site-association file.**
*My apple-app-site-association file:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TeamId.com.Company.AppName",
"paths": [
"/path1-*",
"/path2",
"/path3-*",
"/path4"
]
}
]
}
}
I saw this videos from WWDC 2015 "Seamless linking to your Apps" and "Introducing Search API" and read this App Search Programming Guide.
My website have an SSL certificate (from Authority certified) and my apple-app-site-association is inside https://www.mywebsite.com/apple-app-site-association
I don't know what is wrong with the file. I think syntax error can be but I cant see it.*
seems like you should replace TeamId.com.Company.AppName with your REAL TeamId and REAL bundle id.
Look at this one for exmaple
https://routes.tips/apple-app-site-association
It`s nor signed, but working and passing validation
Dears
There is one more issue about TeamID, especially more than one apps in one accout.
Please use the App IDs prefix into your appID of app-app-site-assiciation.

Resources