Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS通用链接:忽略带参数的路径_Ios_Ios Universal Links - Fatal编程技术网

iOS通用链接:忽略带参数的路径

iOS通用链接:忽略带参数的路径,ios,ios-universal-links,Ios,Ios Universal Links,我无法让iOS通用链接接受一种路径,但忽略另一种非常类似的路径。我想在我的应用程序中打开的路径如下所示: /详细信息/123567,我要忽略的路径如下所示:/details?search=123456 起初,我将/details/*列为白名单,但这打开了这两种链接。添加NOT/details?query=*阻止打开所有链接。我已经读到路径参数被忽略 { "applinks": { "apps": [], "details": [ { "appID"

我无法让iOS通用链接接受一种路径,但忽略另一种非常类似的路径。我想在我的应用程序中打开的路径如下所示: /详细信息/123567,我要忽略的路径如下所示:/details?search=123456

起初,我将/details/*列为白名单,但这打开了这两种链接。添加NOT/details?query=*阻止打开所有链接。我已经读到路径参数被忽略

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "a.b.c",
        "paths": [ "NOT /details?search=*", "/details/*"]
      }
    ]
  }
}
有没有办法成功区分这两种路径?

来自:

请注意,只有URL的路径组件用于比较

那么在查询之后有什么查询参数吗?被忽略。

来自:

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "a.b.c",
        "paths": [ "NOT /details?search=*", "/details/*"]
      }
    ]
  }
}
请注意,只有URL的路径组件用于比较


那么在查询之后有什么查询参数吗?实际上有两个因素会影响代码的实现,第一个是给定路径的顺序。第一条路径的优先级高于其他路径。第二个原因是/*表示匹配子字符串。尝试添加NOT/details?search=/*您缺少星号前的斜杠。如果没有,那么

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "a.b.c",
        "paths": [ "NOT /details?search=*", "/details/*"]
      }
    ]
  }
}
尝试更具体的链接,例如,如果两个链接都是

那么你的苹果应用程序站点关联应该是

  {
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "a.b.c",
        "paths": [ "NOT /category1/details/*", "/category2/details/*"]
      }
    ]
  }
}

如果仍然无法解决您的问题,请提及绝对链接?

实际上有两个因素会影响您的代码实现,第一个是给定路径的顺序。第一条路径的优先级高于其他路径。第二个原因是/*表示匹配子字符串。尝试添加NOT/details?search=/*您缺少星号前的斜杠。如果没有,那么

尝试更具体的链接,例如,如果两个链接都是

那么你的苹果应用程序站点关联应该是

  {
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "a.b.c",
        "paths": [ "NOT /category1/details/*", "/category2/details/*"]
      }
    ]
  }
}

如果仍然无法解决您的问题,请提及绝对链接?

我已设法解决它:

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "a.b.c",
        "paths": [ "NOT /details/", "/details/*"]
      }
    ]
  }
}

我已经设法修复了它:

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "a.b.c",
        "paths": [ "NOT /details/", "/details/*"]
      }
    ]
  }
}
对于iOS13及更高版本

作为参考,您可以处理网站上的某些URL,或者使用特定名称和x个字符的值指定所需的URL查询项,或者指定精确匹配项

json模板:

{
  "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"
          },
          {
            "/": "/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 which has a query item with name 'articleNumber' and a value of exactly 4 characters"
          }
        ]
      }
    ]
  },
  "webcredentials": {
    "apps": [
      "ABCDE12345.com.example.app"
    ]
  }
}
2019年WWDC中提到:

对于一些边缘情况和常见问题,有一个有用的参考

对于iOS13及更高版本

作为参考,您可以处理网站上的某些URL,或者使用特定名称和x个字符的值指定所需的URL查询项,或者指定精确匹配项

json模板:

{
  "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"
          },
          {
            "/": "/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 which has a query item with name 'articleNumber' and a value of exactly 4 characters"
          }
        ]
      }
    ]
  },
  "webcredentials": {
    "apps": [
      "ABCDE12345.com.example.app"
    ]
  }
}
2019年WWDC中提到:

对于一些边缘情况和常见问题,有一个有用的参考


我明白了,但仍然不知道如何区分这两条路径。如果去掉查询参数,路径如下所示:/details和/details/123456。是否可以将第一个黑名单,但允许第二个?123456是一个动态ID,因此不使用占位符的解决方案是不可行的。我明白了,但仍然不知道如何区分这两个路径。如果去掉查询参数,路径如下所示:/details和/details/123456。是否可以将第一个链接列入黑名单,但允许第二个?123456是一个动态ID,因此没有占位符的解决方案是不可行的。我不能更具体地说明链接,因为它们看起来与上面提到的完全相同。123456是一个动态ID。不*匹配任何子字符串吗?不包括/*。至少根据文档。我不能更具体地描述链接,因为它们看起来与上面提到的完全一样123456是一个动态ID。不*匹配任何子字符串吗?不包括/*。至少根据文件。