【问题标题】:iOS Universal Links in FlutterFlutter 中的 iOS 通用链接
【发布时间】:2021-08-28 16:20:50
【问题描述】:

我的 Flutter 应用程序上的 iOS 通用链接似乎无法正常工作。以下是我设置通用链接的步骤:

  • 安装flutteruni_links package

  • 上传了以下 apple-app-site-association(包含团队 ID 和包标识符的实际值):

    {
      "applinks": {
       "details": [
            { 
                "appID": "xxxxxxx.com.bundleIdentifier", 
                "paths": [ "*" ], 
                "appIDs": ["xxxxxxx.com.bundleIdentifier"], 
                "components": [ 
                    { "/": "*" } 
                ] 
            }
       ]
    }}
    
    
  • 通过 https://branch.io/resources/aasa-validator/ 验证的 apple-app-site-association 文件(值得注意的是,我无法使用 Apple 的 appsearch-validation-tool 进行验证 - 收到错误:“无法提取通用链接所需的信息。”)

  • 在我的项目功能中添加了关联域: screenshot from xcode

使用/usr/bin/xcrun simctl openurl 打开或单击我的移动设备上的 url(从 notes 应用程序尝试)仍会在 safari 中打开 url 而不是打开应用程序。

我可能会错过什么?

【问题讨论】:

  • 你使用的服务器是HTTP还是HTTPS?
  • @Shahar HTTPS,并确认内容类型 json
  • mode=developer 添加到您的项目功能以绕过苹果CDN。您还可以在您的设备上生成系统诊断以获取日志文件wwt.com/article/…
  • @Paulw11 感谢您的提示!我将?mode=developer 添加到我的项目功能中,并根据文章运行分析。我的应用程序甚至没有出现在swcutil_show.txt 中,所以我猜这意味着该应用程序甚至没有在寻找 AASA 文件?对我可能错过的东西真的傻眼了。

标签: ios flutter deep-linking ios-universal-links


【解决方案1】:

设备只有在应用版本发生变化时才会读取AASA文件,尝试更改版本/使用其他设备(/其他设备的模拟器)。

【讨论】:

  • 试图增加版本,删除并重新安装应用程序,仍然没有工作:/
【解决方案2】:

您的 apple-app-site-association 将托管在 root 或 .wellknown 路径

您的内容将如下所示,

{
  "applinks": {
  "apps": [],
  "details": [
        { 
            "appID": "xxxxxxx.com.bundleIdentifier", 
            "paths": [ "*" ] 
        },
        {
            "appID": ["xxxxxxx.com.bundleIdentifier"], 
            "paths": [ "*" ]
        } 
   ]
}}

您的文件将可以访问和显示,如下所示
https://google.com/apple-app-site-association
https://example-your-domain.com/apple-app-site-association

您的 apple-app-site-association 文件不包含任何扩展名。
根据您的配置设置内容类型 => https://gist.github.com/anhar/6d50c023f442fb2437e1#-modifying-the-content-type-of-the-apple-app-site-association-file

【讨论】:

  • 是的,我的 apple-app-site-association 托管在 /.well-known/apple-app-site-association。在这里查询时,我实际上可以看到我的 AASA:app-site-association.cdn-apple.com/a/v1。所以我觉得那部分一定是正确的
【解决方案3】:

要检查的另一件事是关联的域是否真的被滚动到构建中。此设置位于 Xcode 中的 Runner => Build Phases => Copy Bundle Resources 下。如果缺少 .entitlements,请点击“+”按钮并添加。 screenshot of xcode

(我不记得我在哪里遇到过这个建议,无论是堆栈溢出还是 github 问题,但如果我再次遇到它会添加它/记住它)。

【讨论】:

    猜你喜欢
    • 2023-01-13
    • 1970-01-01
    • 2023-04-03
    • 2016-01-17
    • 2021-09-11
    • 1970-01-01
    • 1970-01-01
    • 2018-08-01
    • 2018-05-27
    相关资源
    最近更新 更多