2017-08-05 67 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來分享其他東西,所以我需要它。 –

相關問題