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

Ankit Srivastava picture Ankit Srivastava · Feb 8, 2016 · Viewed 8.5k times · Source

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..?

Answer

Vineet Choudhary picture Vineet Choudhary · Mar 5, 2016

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?