2017-08-05 66 views
2

我与AppFlayer SDK和通用链接的深层链接成功打开应用程序意味着深入链接正常工作。当应用程序从链接打开时,appflayer的深度链接不工作(代理方法未调用)

现在的问题是,当应用程序打开链接时,它不会重定向到它的页面。但是,如果我把应用程序在后台,并采取在前台,然后deeplinking作品

我遵循这一指导线。(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代表

编辑::此方法不被调用时应用程序是从appsflayer的链路开放营销应用的

//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) 
    } 

让我知道我做错了。

+0

你是什么意思'..它不会重定向到它的页面。 –

+0

@MaximShoustin对不起我的坏。我的意思是需要在特定位置重定向 –

+0

为什么不使用[Branch](http://branch.io)SDK在打开时执行深度链接。你可以在'application:didFinishLaunchingWithOptions:'中执行你的路由,我相信你应该使用AppsFlyer – clayjones94

回答

0

当您应该从didFinishLaunchingWithOptions拨打电话时,您正在致电willFinishLaunchingWithOptions的AppsFlyerTracker。你能移动相关的代码并再次测试吗?

+0

我已经在didFinishLaunchingWithOptions中初始化它,但得到相同的结果 –

+0

I假设你从'applicationDidBecomeActive'调用'AppsFlyerTracker.shared()。trackAppLaunch()'?   此外,'return Branch.getInstance()。continue(userActivity)'返回YES如果你添加一个断点到'continueUserActivity'?   为了使用AppsFlyer深层链接功能,不需要Branch集成。 – BenjaminAF

+0

是的,我已经将它编码在applicationDidBecomeActive中,我还用分支io来分享其他东西,所以我需要它。 –

相关问题