【问题标题】:How can I test Firebase Dynamic Links if my app is not in the App Store?如果我的应用不在 App Store 中,如何测试 Firebase 动态链接?
【发布时间】:2016-09-21 00:22:54
【问题描述】:

我希望能够在单击动态链接时打开应用程序并打印参数(即使它没有发布)。

有没有办法做到这一点?

【问题讨论】:

  • 你以前见过这个answer 吗?也许实现相同的,只在你需要的地方包含一些日志?

标签: firebase app-store firebase-dynamic-links


【解决方案1】:

是的!事实上,我在入门视频(part 1)(part 2) 中经历了这个确切的过程,如果你还没有,我建议你看看。

但是,一般来说,您只需单击动态链接即可测试“如果我安装了应用,请打开它”流程。如果您的应用程序安装在设备上,它应该可以正常打开;即使它不是已发布的应用。

如果你想测试未安装的流程,这也很简单。

  • 首先,在您的项目设置中为您的 Firebase 项目提供一个应用商店 ID。它可以是任何有效应用商店 ID -- 不一定是您的应用。
  • 然后生成一个新的动态链接。
  • 这一次,当您点击这个新链接时,它应该会将您带到上面列出的 ID 的应用商店。您无需实际安装此应用 - 只需将其添加到应用商店列表即可。
  • 现在,继续重新安装并运行您的应用程序。如果一切正常,它应该会为您检索并显示动态链接数据。

【讨论】:

  • 非常感谢 - 它按预期工作。小补充:为了快速测试,你甚至不需要App store Id-只需点击动态链接,它会去播放商店并显示“找不到项目”。接下来只需安装您的应用程序 - 它会自动接收来自意图的链接并表现得好像链接被按下了..
  • 这是测试未安装流程的好方法。我发现在安装应用程序时会调用 application: UIApplication, continue userActivity: NSUserActivity, restorationHandler 方法,但在未安装应用程序时会调用 app: UIApplication, open url: URL, options 方法。 @Todd Kerpelman 对吗?
  • 完美答案!
  • @Tom Spee 的评论在这里也有帮助.. +1
  • @Todd,当我们点击动态链接场景 1:当应用安装时 :: 我们正确获取 URL。场景 2:当应用程序未安装时,我们将 URL 设为 NULL。在这种情况下如何得到这个?代码参考截图prntscr.com/vfz4jj
【解决方案2】:

我也遇到了同样的问题,在花了很多时间试图找到解决方案后,并按照 Todd Kerpelman post 解释的调试说明进行操作,我可以确定 firebase 没有首先发送通用链接应用启动并发送了具有以下结构的方案 URL:

[bundle_id]://google/link/?deep_link_id=[firebase_universal_link]

识别后,我在 Firesabe SDK 中找到了 dynamicLinkFromCustomSchemeURL 方法,我可以通过动态链接解决我在第一次启动应用时遇到的问题。

/**
 * @method dynamicLinkFromCustomSchemeURL:
 * @abstract Get a Dynamic Link from a custom scheme URL. This method parses URLs with a custom
 *     scheme, for instance, "comgoogleapp://google/link?deep_link_id=abc123". It is suggested to
 *     call it inside your |UIApplicationDelegate|'s
 *     |application:openURL:sourceApplication:annotation| and |application:openURL:options:|
 *     methods.
 * @param url Custom scheme URL.
 * @return Dynamic Link object if the URL is valid and has link parameter, otherwise nil.
 */
- (nullable FIRDynamicLink *)dynamicLinkFromCustomSchemeURL:(NSURL *)url
    NS_SWIFT_NAME(dynamicLink(fromCustomSchemeURL:));

/**
 * @method dynamicLinkFromUniversalLinkURL:completion:
 * @abstract Get a Dynamic Link from a universal link URL. This method parses the universal link
 *     URLs, for instance,
 *     "https://example.page.link?link=https://www.google.com&ibi=com.google.app&ius=comgoogleapp".
 *     It is suggested to call it inside your |UIApplicationDelegate|'s
 *     |application:continueUserActivity:restorationHandler:| method.
 * @param URL Custom scheme URL.
 * @param completion A block that handles the outcome of attempting to get a Dynamic Link from a
 * universal link URL.
 */
- (void)dynamicLinkFromUniversalLinkURL:(NSURL *)url
                             completion:(FIRDynamicLinkUniversalLinkHandler)completion
    NS_SWIFT_NAME(dynamicLink(fromUniversalLink:completion:));

/**
 * @method dynamicLinkFromUniversalLinkURL:
 * @abstract Get a Dynamic Link from a universal link URL. This method parses universal link
 *     URLs, for instance,
 *     "https://example.page.link?link=https://www.google.com&ibi=com.google.app&ius=comgoogleapp".
 *     It is suggested to call it inside your |UIApplicationDelegate|'s
 *     |application:continueUserActivity:restorationHandler:| method.
 * @param url Custom scheme URL.
 * @return Dynamic Link object if the URL is valid and has link parameter, otherwise nil.
 */

【讨论】:

  • 嗨,我也面临同样的问题...您能否详细说明 dynamicLinkFromCustomSchemeURL 或将代码发送给我
猜你喜欢
  • 1970-01-01
  • 2021-04-13
  • 2021-10-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-05
  • 2014-03-20
  • 1970-01-01
相关资源
最近更新 更多