苹果应用站点关联子域设置

问题描述 投票:0回答:1

让我们试着举一个最能解释我的问题的例子。假设我在

example.com
上提供了我的应用程序,并且还创建了一些通用链接,例如
example.com/application
,如果安装了应用程序,则在从应用程序内部打开的电话设备上单击该链接。这很好用。

现在我可以创建子域,比如

app.example.com
如果你点击它,它也会在应用程序内部打开。因此,如果已安装,
app.example.com/*
的几乎所有路径都应在应用程序中打开。

这样做的过程是什么。我是否必须创建一个子域,这可以通过添加关联域来完成吗,我的

apple-app-site-association
文件看起来如何?

我知道我的问题很模糊,但只是看看一些关于这样做的起始指针或文档。希望有人给出一些建议就足够了

ios deep-linking ios-universal-links apple-app-site-associate
1个回答
0
投票

我在我的 apple-app-site-association 文件中使用这个 JSON。

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "your appID and bundle identifier",
                "paths": ["*", "/*"]
            }
        ]
    }
}

您还可以查看此示例(由 Apple 提供)以在您的 apple-app-site-association 文件中添加子域。

{
  "applinks": {
      "details": [
           {
             "appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
             "components": [
               {
                  "#": "no_universal_links",
                  "exclude": true,
                  "comment": "Matches any URL with a fragment that equals no_universal_links and instructs the system not to open it as a universal link."
               },
               {
                  "/": "/buy/*",
                  "comment": "Matches any URL with a path that starts with /buy/."
               },
               {
                  "/": "/help/website/*",
                  "exclude": true,
                  "comment": "Matches any URL with a path that starts with /help/website/ and instructs the system not to open it as a universal link."
               },
               {
                  "/": "/help/*",
                  "?": { "articleNumber": "????" },
                  "comment": "Matches any URL with a path that starts with /help/ and that has a query item with name 'articleNumber' and a value of exactly four characters."
               }
             ]
           }
       ]
   },
   "webcredentials": {
      "apps": [ "ABCDE12345.com.example.app" ]
   },

    "appclips": {
        "apps": ["ABCED12345.com.example.MyApp.Clip"]
    }
}

有关更多信息,您可以查看此链接:https://developer.apple.com/documentation/xcode/supporting-associated-domains

© www.soinside.com 2019 - 2024. All rights reserved.