iosxcode7ios-universal-linksapple-app-site-associate

in apple app site association file, why "NOT" doesn't exclude path mentioned?


I have added universal links into my iOS application

messages http://somesite.com/message/list/ >> opens the app to messages 
review   http://somesite.com/review/add/   >> opens the app to review 
place    http://somesite.com/place/add/    >> opens the app to place 
photo    http://somesite.com/photo/add/    >> opens the app to photo

all working as expected, my question is : how to exclude paths or urls, in a way that it never even opens the app?

for example

somepage   http://somesite.com/somepagelink   >> SHOULDN'T OPEN APP, it must show up in the browser.

the apple app site association file

{
    "applinks": 
    {
        "details": [
        {
            "paths": ["*", "NOT /somepagelink/*"],
            "appID": "ID1.myApp"
        }, 
        {
            "paths": ["*", "NOT /somepagelink/*"],
            "appID": "ID2.myApp"
        }],
        "apps": []
    },
    "activitycontinuation": 
    {
        "apps": ["ID1.myApp","ID2.myApp"]
    }
}

is this the correct way to exclude a path?

"NOT /somepagelink/*"

Solution

  • Yes, your syntax is correct but:

    The Apple documentation states, that the order of the statement is important.

    Because the system evaluates each path in the paths array in the order it is specified—and stops evaluating when a positive or negative match is found—you should specify high priority paths before low priority paths.

    The first statement it evaluates in your file is the star "*" which signals "yes, every URL is allowed". Then it will end and open the app.

    So maybe try it the other way round?

    "paths": ["NOT /somepagelink/*", "*"],
    

    EDIT

    IMPORTANT: This is from the comments given below, apart from changes in AASA. You have to reinstall the app for every change to the apple-app-site-association file. It could definitely be a CDN problem if you are using one of those