我已为 ios 应用程序启用深度链接,但我想限制调用移动应用程序的“特定链接”。我尝试了下面的代码,但应用程序仍然从该网址启动。
{
"applinks": {
"apps": [],
"details": [
{
"appID": "YOURTEAMID.your.bundle.identifier",
"paths": [
"*",
"NOT /blocked-page",
"NOT /private/*"
]
}
]
}
}
那么我们该如何限制呢?
从 iOS 13 开始,格式发生了一些变化。 新格式是这样的:
"applinks": {
"details": [
{
"appIDs": [
"ABCDE12345.com.example.app",
"ABCDE12345.com.example.app2"
],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link. Like example.com/path?query=1234#no_universal_links"
},
{
"/": "/buy/*",
"comment": "Matches any URL whose path starts with /buy/"
},
{
"/": "/help/website/*",
"exclude": true,
"comment": "Matches any URL whose path starts with /help/website/ and instructs the system not to open it as a universal link"
},
{
"/": "/help/*",
"?": {
"articleNumber": "????"
},
"comment": "Matches any URL whose path starts with /help/ and that has a query item with name 'articleNumber' and a value of exactly 4 characters"
}
]
}
]
}
请注意,更改 AASA 文件的内容后,您需要等待 Apple CDN 有更新的版本。 要检查 Apple CDN 是否已拥有它,请使用
https://app-site-association.cdn-apple.com/a/v1/YOURDOMAIN
执行简单的 GET 请求,并检查结果是否与您的 AASA 文件的最新状态匹配。