我使用 AppFlayer SDK 进行了深度链接,并且通用链接成功打开了应用程序,这意味着深度链接工作正常。
现在的问题是 当应用程序从链接打开时,它不会重定向到它的页面。但是,如果我将应用程序放在后台并放在前台,那么深度链接就可以工作
我遵循此指南。( link )
AppFlayer 设置代码
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
AppsFlyerTracker.shared().appsFlyerDevKey = "xxxxxxxxxxxx"
AppsFlyerTracker.shared().appleAppID = "xxxxxxx"
AppsFlyerTracker.shared().isDebug = false
AppsFlyerTracker.shared().delegate = self
self.pushNotificationService(application)
objStoryBoard = UIStoryboard(name:"Main", bundle: nil)
return true
}
AppFlayer 委托(delegate)
Edit :: This method not called when application is open from link of appsflayer marketing
//MARK:
//MARK: appflayer delegate
func onAppOpenAttribution(_ installData: [AnyHashable: Any]) {
NSLog("installData ::%@", installData )
if let link = installData["link"] as? String
{
if link.contains(read_Localizable("titleAppflayer"))
{
if let arrQueryItems = URLComponents(string: link)!.queryItems {
for obj in arrQueryItems {
if obj.name.caseInsensitiveCompare(read_Localizable("appflayerParameter")) == .orderedSame
{
self.redirectAppflayer(withstrUrl: obj.value!)
return
}
}
}
}
}
}
应用的用户事件方式
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
// if let url = userActivity.webpageURL
// {
// NSLog("URL :: %@",[url])
// }
if userActivity.webpageURL?.absoluteString.contains(read_Localizable("titleAppflayer")) == true
{
AppsFlyerTracker.shared().continue(userActivity, restorationHandler: restorationHandler)
return true
}
return Branch.getInstance().continue(userActivity)
}
让我知道我做错了什么。
您正在从 willFinishLaunchingWithOptions
调用 AppsFlyerTracker,而应该从 didFinishLaunchingWithOptions
调用它。能不能把相关代码挪一下再测试一下?
关于ios - 从链接打开应用程序时,appsflyer 深层链接不起作用(未调用委托(delegate)方法),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45523157/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) | Powered by Discuz! X3.4 |