在 firebase 动态 link 的 ios 中获取动态 link url
Get dynamic link url in ios of firebase dynamic link
未安装我的应用程序时,我先安装我的应用程序,安装后可以获得动态link。
但是当我的应用程序已经安装时,我的应用程序直接启动,但我无法获取动态link。
如何在安装我的应用程序时获取动态 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.swiftSwift4和Swift5有些接口不一样,我用的是Swift4接口
匹配接口后,效果很好
未安装我的应用程序时,我先安装我的应用程序,安装后可以获得动态link。
但是当我的应用程序已经安装时,我的应用程序直接启动,但我无法获取动态link。
如何在安装我的应用程序时获取动态 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.swiftSwift4和Swift5有些接口不一样,我用的是Swift4接口
匹配接口后,效果很好