在苹果应用程序站点关联文件中,为什么 "NOT" 不排除提到的路径?

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

我已将通用链接添加到我的 iOS 应用程序中

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

一切都按预期工作,我的问题是:如何排除路径或 url,甚至不会打开应用程序?

例如

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

苹果应用站点关联文件

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

这是排除路径的正确方法吗?

"NOT /somepagelink/*"

是的,你的语法是正确的,但是:

Apple 文档指出,语句的顺序很重要。

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.

它在您的文件中评估的第一个语句是星号“*”,表示 "yes, every URL is allowed"。然后它会结束并打开应用程序。

那么可以反过来试试吗?

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

编辑

重要: 这是来自下面给出的评论,除了 AASA 的变化。 您必须为 apple-app-site-association 文件的每次更改重新安装该应用程序。如果您使用其中之一,那肯定是 CDN 问题