【问题标题】:Get dynamic link url in ios of firebase dynamic link在firebase动态链接的ios中获取动态链接url
【发布时间】:2019-11-18 16:58:37
【问题描述】:

当我的应用没有安装,我先安装我的应用,安装后可以得到动态链接。

但是当我的应用已经安装后,我的应用直接启动了,但是我获取不到动态链接。

我的应用安装后如何获取动态链接网址?

这是我的快速代码(AppDelegate.swift)

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
        // dynamic link
        if let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url) {
            // Handle the deep link. For example, show the deep-linked content or
            // apply a promotional offer to the user's account.
            // ...
            handleIncoingDynamicLink(dynamicLink) //<-not fired
            return true
        }

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
        if let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url) {
            // Handle the deep link. For example, show the deep-linked content or
            // apply a promotional offer to the user's account.
            // ...
            print(dynamicLink)  //<-- not fired
            handleIncoingDynamicLink(dynamicLink)

            return true
        }

        let handled: Bool = ApplicationDelegate.shared.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
        return handled
    }

【问题讨论】:

    标签: ios swift firebase firebase-dynamic-links


    【解决方案1】:

    对不起。这是我的错误。

    AppDelegate.swift 的某些接口在 Swift4 和 Swift5 之间不一样,我使用的是 Swift4 接口。

    接口匹配后,效果很好。

    【讨论】:

      猜你喜欢
      • 2020-03-18
      • 2019-11-04
      • 2022-12-23
      • 2020-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-16
      • 1970-01-01
      相关资源
      最近更新 更多