[英]Get dynamic link url in ios of firebase dynamic link
当我的应用程序没有安装时,我先安装我的应用程序,安装后我可以得到动态链接。
但是当我的应用程序已经安装时,我的应用程序直接启动了,但我无法获取动态链接。
安装我的应用程序后,如何获取动态链接 url?
这是我的 swift 代码(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
}
对不起。 这是我的错误。
AppDelegate.swift 的某些接口在 Swift4 和 Swift5 之间不一样,我使用的是 Swift4 接口。
匹配接口后,效果很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.