有没有办法识别该应用程序是通过 didFinishLaunchingWithOptions 中的 firebase 动态链接安装的?

jan*_*ula 2 ios firebase swift firebase-dynamic-links

我正在我的 iOS 应用程序中实现 firebase 动态链接,我已经可以解析链接,重定向到 AppStore 等。现在我想区分应用程序的第一次运行,当用户从动态链接安装它时 - 我想跳过介绍并向他展示预期展示的内容。

是否有一些我可以捕捉的参数,application(_:didFinishLaunchingWithOptions:)以便我可以说它是通过动态链接启动的?

该方法application(_:continueUserActivity:userActivity:restorationHandler:)稍后调用,因此介绍已经启动。

这种情况很难测试,因为您必须在 AppStore 上发布您的应用程序。

Ale*_*uer 5

您实际上不需要在 App Store 中发布应用程序即可运行 — 单击链接,关闭 App Store,然后通过 Xcode(或任何其他测试版分发平台,如 TestFlight 或 Fabric)安装应用程序构建完全一样的效果。

根据Firebase 文档,第一次安装调用的方法是openURL(不,这对我来说也没有意义)。该continueUserActivity方法适用于通用链接,仅当打开链接时已安装应用程序时才使用。

我不知道有什么方法可以检测从“延迟”链接安装后第一次打开应用程序的时间,但是只要存在深层链接,您就可以直接路由到共享内容(跳过介绍)。如果不存在深层链接,请显示常规介绍。


替代选项

您可以查看Branch.io(完全披露:我在 Branch 团队中)。除其他外,Branch 是 Firebase 动态链接的绝佳免费替代品,具有大量附加功能。以下是 Branch 立即返回的所有参数的示例didFinishLaunchingWithOptions

{  
    "branch_view_enabled"   = 0; 
    "browser_fingerprint_id" = "<null>"; 
    data = "{  
      \"+is_first_session\":false,
      \"+clicked_branch_link\":true,
      \"+match_guaranteed\":true,
      \"$canonical_identifier\":\"room/OrangeOak\",
      \"$exp_date\":0,
      \"$identity_id\":\"308073965526600507\",
      \"$og_title\":\"Orange Oak\",
      \"$one_time_use\":false,
      \"$publicly_indexable\":1,
      \"room_name\":\"Orange Oak\", // this is a custom param, of which you may have an unlimited number
      \"~channel\":\"pasteboard\",
      \"~creation_source\":3,
      \"~feature\":\"sharing\",
      \"~id\":\"319180030632948530\",
      \"+click_timestamp\":1477336707,
      \"~referring_link\":\"https://branchmaps.app.link/qTLPNAJ0Jx\"
    }"; 
    "device_fingerprint_id" = 308073965409112574; 
    "identity_id" = 308073965526600507; 
    link = "https://branchmaps.app.link/?%24identity_id=308073965526600507"; 
    "session_id" = 319180164046538734;
}
Run Code Online (Sandbox Code Playgroud)

您可以在此处的 Branch 文档中阅读有关这些参数的更多信息。

  • 嘿@NSTJ,感谢您的反馈!OP 询问了一些在 Firebase 中无法完成的问题。希望他们发现了解替代解决方案很有帮助 (2认同)