【问题标题】:Universal Links - Cordova iOS application通用链接 - Cordova iOS 应用程序
【发布时间】:2021-12-29 07:26:47
【问题描述】:

我正在尝试为我的一个应用程序实现通用链接。我已经参考了 stackoverflow 中的几乎所有票证,但由于某种原因仍然无法使其工作。以下是我正在遵循的过程。

创建apple-app-site-association 文件并添加到内容下方

    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "TEAM_ID.BUNDLE_ID",
                "paths": [ "*" ]
            }
        ]
    }
}

将此文件上传到源代码中的“公共”文件夹。还在 nginx 配置中将 content-type 更改为 json。

location /apple-app-site-association {
    default_type application/json;
}

当我在终端中运行此命令时,它显示内容类型已更改为 application/json。下面是参考。 curl -I http://ec2-34-201-173-250.compute-1.amazonaws.com:8080/apple-app-site-association 输出如下:

HTTP/1.1 200 OK
Server: nginx/1.14.0 (Ubuntu)
Date: Thu, 18 Nov 2021 11:39:43 GMT
Content-Type: application/json
Content-Length: 192
Last-Modified: Mon, 15 Nov 2021 09:46:17 GMT
Connection: keep-alive
ETag: "61922c69-c0"
Accept-Ranges: bytes

当我点击link 时,它会毫无问题地打开apple-app-site-association json。

但由于某种原因,apple-appsearch-vaidation-tool 失败并出现以下响应

Link to Application
Action required
Could not extract required information for application links. Learn how to implement the recommended Universal Links.
Error cannot fetch app site association

更多信息: 它是一个 HTTP 域 - 不确定我是否需要上传签名的 apple-app-site-association 文件。

请帮我解决这个问题。

提前致谢。

【问题讨论】:

  • 有人可以帮我解决这个问题吗?这对发布非常关键。

标签: ios objective-c ios-universal-links


【解决方案1】:

根据 Apple 文档,您应该将您的 apple-app-site-association 上传到支持 HTTPS 有效协议的服务器上,此外他们还指定该文件应位于 /.well-known 文件夹中,我与您分享有关此的有用链接:

https://developer.apple.com/documentation/xcode/supporting-associated-domains

另一方面,要验证您的 apple-app-site-association 文件是否已正确托管,您可以使用以下链接对 AASA 文件使用 branch.io 验证器:

https://branch.io/resources/aasa-validator/#resultsbox

我验证了您的 apple-app-site-association 文件,branch.io 验证器显示以下内容:

如果您的服务器的 SSL 有问题,也许您可​​以使用 Firebase 托管,此工具为您提供一个配置了 HTTPS 的免费域,以及保存apple-app-site-association 文件的主机,如果您使用此功能请记住,firebase.json 文件的可能配置是:

{
  "hosting": {
    "public": "public",
    "headers": [
      {
        "source": "/apple-app-site-association",
        "headers": [{"key": "Content-Type", "value": "application/json"}]
      }
    ],
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "appAssociation": "NONE"
  }
}

Firebase 项目文件夹将有一个类似这样的脚手架:

问候!

【讨论】:

  • Apple 文档说:“构建关联文件后,将其放在站点的 .well-known 目录中。文件的 URL 应与以下格式匹配:https:/// .well-known/apple-app-site-association 您必须使用带有有效证书且没有重定向的 https:// 托管文件。”
猜你喜欢
  • 2020-07-19
  • 1970-01-01
  • 2017-07-26
  • 2014-07-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多