iOS通用应用链接可以支持使用同一域的多个应用吗?

问题描述:

背景:


  1. 为多个客户构建普通应用。
    同一代码库具有不同的包ID,即:

  1. Building a vanilla app for multiple clients. Same code base with different bundle ids, i.e.:

com.company.client1

com.company.client1

com .company.client2

com.company.client2

要支持具有相同通用应用链接的所有客户端构建,即:

Want to support all client builds with the same universal app link, i.e.:

company.com/app/path

company.com/app/path

试图将其添加到 apple-app-site-association文件中

Tried to add this to the 'apple-app-site-association' file

苹果应用程序站点关联文件:

'apple-app-site-association' file:

{"applinks": {"apps": [],"details": [
{"paths": ["/app/*"],"appID": "XXXXXXXXXX.com.company.client1"},
{"paths": ["/app/*"],"appID": "XXXXXXXXXX.com.company.client2"}]}

这是苹果的限制吗?

这是可能的。 Apple在通用链接上对相同域中的多个应用程序没有任何限制。

This is possible. There is no limitation from Apple on Universal Links for multiple apps on the same domain.

似乎您的 apple-app-site-association 格式错误。您需要使它看起来像这样:

It appears your apple-app-site-association is malformed. You need it to look like this:

{
  "applinks": {
    "apps": [ ],
    "details": [
      {
        "appID": "XXXXXXXXXX.com.company.client1",
        "paths": [
          "/app/*"
        ]
      },
      {
        "appID": "XXXXXXXXXX.com.company.client2",
        "paths": [
          "/app/*"
        ]
      }
    ]
  }
}

请注意 appID paths 键的顺序,以及最后一个关闭}

Note the order of the appID and paths keys, and the final closing }.

如果安装了多个应用程序,您还会遇到此设置问题,因为它们都在注册相同的路径。您可能需要考虑为每个ID添加一个唯一ID,例如 / app / client1 / *

You will also run into issues with this setup if more than one app is installed, since they're all registering for the same paths. You may want to consider adding a unique ID to each one, such as /app/client1/*.

另一个重要说明是通用链接在很多情况下都无法使用,因此这不是一个完整的深度链接解决方案(尽管苹果公司一厢情愿地宣称相反)。如果您想要一种更简单的深层链接方法,该方法可以轻松处理这样的多应用程序需求,请查看 Branch.io (完全披露:我在分公司团队中)。

Another important note is that Universal Links don't work in many situations so this is not a complete deep linking solution (despite Apple's wishful claims to the contrary). If you want a simpler deep linking approach that will easily handle a multi-app requirement like this, take a look at Branch.io (full disclosure: I'm on the Branch team).