Universal link not working for multiple apps

I have created a universal link which I m using for two different applications in macOS. Below is the apple-app-site-association file for the same:

{
"applinks":{
   "apps":[],
     "details":[
        {
           "appID":"E5R4JF6D5K.com.demo.App1",
           "paths":[
                "/app1/*"
            ]
        },
        {
          "appID":"E5R4JF6D5K.world.demo.App2",
          "paths":[
              "/app2/*"
           ]
         }
      ]
   }
}

After creating this file in my server and providing the same Url in my associated domain capability for both my application, when I try to launch my applications using the link then only the first application is getting launched everytime. The second application is never launched.

for Url with http://custom.com/app1/... it redirects to first app.

for Url with http://custom.com/app2/... it redirects to browser.

I tried uninstalling the first app, but then it always directs in browser. I tried a separate url for both apps, and it works fine.

I m not able to figure out the problem. The apple documentation says that it is possible to have two application linked to a common domain. Any help?

I'm curious if it's the structure of the app site association file? 🤔

The structure was updated at some point, sorry I don't remember exactly when. https://developer.apple.com/documentation/xcode/supporting-associated-domains#Add-the-associated-domain-file-to-your-website

Here's what it would look like with the current structure. I'm not entirely sure why it doesn't work with your current file, but maybe this might help.

{
"applinks":{
     "details":[
        {
           "appIDs": ["E5R4JF6D5K.com.demo.App1"],
           "components":[
                {
                    "/": "/app1/*"
                },
            ]
        },
        {
          "appIDs": ["E5R4JF6D5K.world.demo.App2"],
          "components": [
              {
                    "/": "/app2/*"
                },
           ]
         }
      ]
   }
}

I have a similar issue, checking the analytics seems like the second appIDs aren't getting matched and it stops at the first one. Which is weird because that would mean we can't separate concerns (accepted patters) for different apps

Universal link not working for multiple apps
 
 
Q