【问题标题】:Firebase Dynamic Link doesn't redirect to the app when open through Safari通过 Safari 打开时,Firebase 动态链接不会重定向到应用程序
【发布时间】:2018-02-28 13:10:28
【问题描述】:

我在我的应用程序中添加了Firebase Dynamic Link,当我通过Google Chrome 在iPhone 链接中打开时,它会将我重定向到应用程序,但是当我尝试通过Safari 打开应用程序时(我通过 Notes 打开链接,而不是直接从 Safari),它不会打开应用程序。

我在真实设备上进行测试,而不是在模拟器中。

我关注了官方Firebase Dynamic Links Tutorial。

可能出了什么问题,如何解决?

【问题讨论】:

  • Safari 是您的默认浏览器吗?
  • 是的,Safari 是我的默认浏览器!
  • 你设置了url方案吗?您是否在 appDelegate 类方法名称“openURL”中收到回调?。
  • 我已经设置了 URL Scheme,我没有在回调中收到任何内容,因为通过 Safari 打开时应用程序没有被调用
  • 好的,你知道 Chrome 使用 URI 方案,Safari 默认使用通用链接吗?

标签: ios firebase mobile-safari firebase-dynamic-links


【解决方案1】:

我的问题是在 Xcode Capabilities Associated Domains 的 Tab 中,在 Domains 字段中,我写了错误的域,而不是 appplinks:app_id.app.goo.gl 我写了:appplinks:app_id.goo.gl,所以我错过了.app, app_id之后,改了之后就可以正常工作了!

【讨论】:

  • 根据firebase官方文档,我们应该在关联域中设置值,例如applinks:your_subdomain.page.link你能告诉我app_id和app是什么例子
【解决方案2】:

将 applinks:appName.page.link 添加到 xcode 中的关联域

https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_associated-domains 您无法通过 safari 打开您的应用,您只能通过点击链接或使用 iPhone 相机扫描它(QR)来打开它

【讨论】:

  • 我确实添加了这个,我没有在 safari 中输入 URL,而是将其添加到注释中并从那里单击链接,但它仍然只在 safari 中而不是在应用程序中打开它。不过,它在模拟器中确实可以正常工作,所以我迷路了。有什么想法吗?
【解决方案3】:

我们在尝试在我们的应用中实现 Firebase 动态链接时发现的一件事是,Apple 应用关联文件必须位于网络服务器上的 .well_known 目录中。 Apple 的应用关联文档指出关联文件可以位于根目录或 .well_known 中:

Place this file either in your site’s .well-known directory, or directly in its root directory.

Setting Up an App's Association File

但是,在设备上执行全新安装应用程序时查看网络服务器日志时,我们看到对 .well_known 目录进行了调用。一旦我们将关联文件复制到 .well_known 目录,Firebase 动态链接就会按预期工作。

【讨论】:

    猜你喜欢
    • 2023-01-16
    • 2021-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-07
    • 1970-01-01
    • 2019-06-16
    • 1970-01-01
    相关资源
    最近更新 更多