如何知道应用是通过didFinishLaunchingWithOptions中的firebase动态链接安装的?

如何知道应用是通过didFinishLaunchingWithOptions中的firebase动态链接安装的?

问题描述:

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

I am implementing firebase dynamic links in my iOS app and I can already parse the link, redirect to AppStore etc. Now I want to distinguish the first run of the app, when user installs it from the dynamic link - I want to skip the intro and show him the content that is expected to be shown.

在进入didFinishLaunchingWithOptions之前,是否有办法知道该应用程序是如何打开的?

Is there a way to know how the app is opened before being in didFinishLaunchingWithOptions?

当Firebase动态链接iOS SDK完成检索挂起的(延迟的)动态链接时,将调用方法application:openURL:options:. 如果找到了挂起的动态链接,则对象[[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url]将具有非nil属性url. url等于您的深层链接,该用户在未安装您的App时点按了该链接.如果未找到链接,则此属性为nil.

The method application:openURL:options: will be called when Firebase Dynamic Links iOS SDK finished retrieving the pending (deferred) dynamic link. If pending dynamic link is found, the object [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url] will have non-nil property url. The url will be equal to your deep link, that user tapped while your App was not installed. If link is not found, this property will be nil.

我建议您在didFinishLaunchingWithOptions中显示加载屏幕".当Firebase Dynamic Links SDK将结果传递给您时,如果找到了挂起的动态链接,则可以继续进行自定义加载.如果未找到挂起的动态链接,则默认为启用.请记住,如果网络速度较慢,则可能需要一些时间.您可能希望将超时设置为X秒,以免用户在正在加载屏幕"时停留太长时间.

I suggest you to show "loading screen" in your didFinishLaunchingWithOptions. When Firebase Dynamic Links SDK will pass you result, you can proceed with custom onboarding if pending dynamic link is found. Or default onboarding if pending dynamic link is not found. Keep in mind, if network is slow, this may take some time. You may want to have timeout set to X seconds, to not hold your user too long at "loading screen".

有关在iOS上接收Firebase动态链接的文档 https://firebase.google .com/docs/dynamic-links/ios/receive

Documentation about receiving Firebase Dynamic Links on iOS https://firebase.google.com/docs/dynamic-links/ios/receive