Supporting same domain on two different apps supporting universal links..? - ios

I have an application which supports universal links and it is currently in the app store.
Say it supports the domain www.example.com and thus universal links can be easily opened via this. We will have applinks:www.example.com in associated domains.
Now say if I want to release another app and it also supports the same domain. Now how will iOS distinguish which app to open via universal links..?

In order to supporting Universal Links with single domain on two different apps you need to make changes in your existing apple-app-site-association file, at https://{domain}/apple-app-site-association.
For Single App Support
For single application support it's look like this
{
"applinks": {
"apps": [],
"details": [
{
"appID": "1234ABCDE.com.domain.myapp",
"paths": ["*"]
}
]
}
}
For Multiple App Support
For multiple application support, you need add one more key-value pair in details array of applinks in apple-app-site-association. It's look like this
{
"applinks": {
"apps": [],
"details": [
{
"appID": "1234ABCDE.com.domain.myApp",
"paths": ["*"]
},
{
"appID": "1234ABCDE.com.domain.mySecondApp",
"paths": ["*"]
},
{
"appID": "1234ABCDE.com.domain.myThirdApp",
"paths": ["*"]
}
]
}
}
General Format of apple-app-site-association file
The file looks like this:
{
"applinks": {
"apps": [ ],
"details": [
{
"appID": "{app_prefix}.{app_identifier}",
"paths": [ "/path/to/content", "/path/to/other/*", "NOT /path/to/exclude" ]
},
{
"appID": "TeamID.BundleID2",
"paths": [ "*" ]
}
]
}
}
References
How to support Universal Links in iOS App and setup server for it?

I found the solution, its pretty simple though.
My problem was that my first app was supporting all the pages by stating
"*" in the paths section of apple-app-site-association file. Now all I have to do is add NOT in front of one of the paths which I wanted my second app to handle.
like "NOT /cabs". I haven't tested it yet if this works or not. I will post an update as soon as I am done with it.

Apple App Site Association file example
{
"applinks": {
"apps": [],
"details": [{
"appID": "D3KQX62K1A.com.example.photoapp",
"paths": ["/albums"]
},
{
"appID": "D3KQX62K1A.com.example.videoapp",
"paths": ["/videos"]
}]
}
}
Important: The order of the dictionaries in the array determines the order the system follows when looking for a match. The first match wins, allowing you to designate one app to handle specified paths within your website, and another app to handle the rest.
References:
https://developer.apple.com/documentation/uikit/core_app/allowing_apps_and_websites_to_link_to_your_content/enabling_universal_links

Related

How to add paths to the apple-app-site-association file if a site has subpaths for determining locales?

I am having doubts regarding a particular scenario on adding paths to an association file.This is an association file for a site www.abc.com.Now the site starts to support localization ,For ex. www.abc.com/en-ca for Canada,it will display a localised Canadian site.In future more locales will be added.The rest of the paths mentioned in the association file are same (ex. www.abc.com/path1/* now becomes www.abc.com/en-ca/path1/*.How can the association file be modified in such a way that it supports www.abc.com/en-ca and many more locales in the future?
{
"applinks": {
"apps": [],
"details": [
{
"appID": "teamid.com.xxx.appName",
"paths": [
"/",
"/path1/*",
"/xx/xx/path2*",
"/path3",
"/path4/*",
"/path5*",
"/path6*"
]
}
]
},
"webcredentials": {
"apps": [
"teamid.com.xxx.appName"
]
}
}
As Documentation says you can use:
/photography/*/samples/201?/mypage
So in your example, it would be:
"paths": [
"/",
"/path1/*",
"/xx/xx/path2*",
"/path3",
"/path4/*",
"/path5*",
"/path6*"
"/*/",
"/*/path1/*",
"/*/xx/xx/path2*",
"/*/path3",
"/*/path4/*",
"/*/path5*",
"/*/path6*"
]

deeplinking iOS with dynamic url

I want to perform a deeplink to my iOS app to reset the app
my url goes https://something/en/reset-password?...
I made the needed apple-app-site-association
this works when i put in the path section
"paths": [
"*"
]
but when I change it to
"paths": [
"/(fr|en)/reset-password*"
]
the app doesn't open/ link to app is gone
Is there something wrong with the paths formatting?
Check your path section * .
Your file format should be like this.
{
"applinks": {
"apps": [],
"details": [
{
"appID": "BundleIdentifierOfYourApp",
"paths": ["/reset-password/*"]
}
]
}
}
Even you can add more as per your need in the path section like.
["/reset-password/*","reset-password1/*","reset-password2/*"]

iOS Universal Links fails to Open the App

4 months ago we used to have Universal Links enabled and it was all good. But we have decided to black-list paths instead of white-listing them. So we have replace the paths with NOT /path/*. After deploying the files to our domains and subdomain. It seems that the iOS is not associating the domains at all.
Our file looks like this
{
"applinks": {
"apps": [],
"details": [
{
"appID": "1242141.com.app.dev",
"paths": [
"NOT /path1/*",
"NOT /path2/*",
"NOT /path3/*",
"NOT /path4/*",
"NOT /path5/*",
"NOT /path6/*"
]
},
{
"appID": "1231411.com.app.production",
......
Another question, if you have app extensions (say a rich push service) do you need to enable Associated Domains for them as well or not?
You also need to add the paths which are allowed
Use something like:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "1242141.com.app.dev",
"paths": [
"*",
"NOT /path1/*",
"NOT /path2/*",
"NOT /path3/*",
"NOT /path4/*",
"NOT /path5/*",
"NOT /path6/*"
]
}
]
}
}

iOS Universal Links apple-app-site-association File Mix 2 Signatures For Same App

I have an app on the app store that use UniversalLinks I want to be able to test the functionality in development also.
Is it possible to have the apple-app-site-association file like so with both signatures?
{
"applinks": {
"apps": [ ],
"details": [
{
"appID": "XXXXXXXXXX.EP.myCompany.client",
"paths": [
"*", "/"
]
},
{
"appID": "XXXXXXXXXX.com.myCompany.client",
"paths": [
"*", "/"
]
}
]
}
}
Yes, you can.
Check out examples from others to see how AASA is formatted. Like https://facebook.com/apple-app-site-association or https://amazon.com/apple-app-site-association

Universal links of two app open ever the same app with Branch.io

All my applications use the same custom domain, namely links.ci--e.es.
My app are:
Co-ba -> Bundle id --> com.cit--e.co-ba
Ca-as -> Bundle id --> com.cit--e.ca-as
Gu-la -> Bundle id --> com.cit--e.gu-la
In each app:
I have installed on my device my applications.
I have correctly set up all my applications. Both live and test dashboard. Also in XCode.
I consider the code for facebook. And I added the code to my Applications.
In Validator universal links, personalized domain, the bundle id and return prefix me this json. And everything is correct.
Validator Universal Links
Validator Universal Links
{
"applinks": {
"apps": [],
"details": [
{
"appID": "ZXXXXXXXX4.com.ci--e.co-ba",
"paths": [
"*",
"/"
]
},
{
"appID": "ZXXXXXXXX4.com.ci--e.gu-la",
"paths": [
"*",
"/"
]
},
{
"appID": "ZXXXXXXXX4.com.ci--e.ca-as",
"paths": [
"*",
"/"
]
},
{
"appID": "ZXXXXXXXX4.com.ci--e.test",
"paths": [
"*",
"/"
]
},
{
"appID": "ZXXXXXXXX4.com.ci--e.co-ba",
"paths": [
"*",
"/"
]
},
{
"appID": "ZXXXXXXXX4.com.ci--e.gu-la",
"paths": [
"*",
"/"
]
},
{
"appID": "ZXXXXXXXX4.com.ci--e.test",
"paths": [
"*",
"/"
]
}
]
}
}
For each of my applications I make marketing link. Example:
App name Co-ba
- htttp://link.ci--e.es/TzUm/CL1D25b4tt
App name Ca-as
- htttp://link.ci--e.es/LKVl/wkb27JqVtt
App name Gu-la
- htttp://link.ci--e.es/lySm/ygacY4N2tt
And these links work correctly when there is a single application installed on my device. Links do not work properly when installed have more than one application.
The links I always open the same application even if they belong to another application. Example:
If you have installed Co-ba and Gu-la. I open a link on my device Co-ba and the Co-ba app opens. I open a link on my device Gu-la and the app opens Co-ba. This is a mistake. Where you can be the fault?
thanks for your reply.
Alex from Branch.io here:
Short version
Branch doesn't currently support multiple apps on the same domain, so there will be some unavoidable unexpected behavior. I recommend using different subdomains for each app.
Longer explanation
The reason this is happening is because all three apps are registered to open the same Universal Links URLs. Co-ba is just the first one in the apple-app-site-association file, so it is the one that opens by default when several apps are installed.
If you look at the Branch link links for each app, you'll see there is a four character unique ID in each one.
Co-ba: TzUm
Ca-as: LKVl
Gu-la: lySm
This four character ID is what Branch uses to separate the links for each app, so that only the correct app opens. You will need to host your own apple-app-site-association file and update it to look like this (also getting rid of the duplicate entries):
{
"applinks": {
"apps": [],
"details": [
{
"appID": "ZXXXXXXXX4.com.ci--e.co-ba",
"paths": [
"/TzUm/*",
"/a/Branch-key-for-co-ba/*"
]
},
{
"appID": "ZXXXXXXXX4.com.ci--e.gu-la",
"paths": [
"/lySm/*"
"/a/Branch-key-for-gu-la/*"
]
},
{
"appID": "ZXXXXXXXX4.com.ci--e.ca-as",
"paths": [
"/LKVl/*"
"/a/Branch-key-for-ca-as/*"
]
}
]
}
With this solution, you must keep in mind that Marketing links created on the Branch dashboard (and any other link you create with a custom alias) will not work, because they do not have the four character identifier.

Resources