2017-08-09 79 views
0

開始我需要得到亂舞會話ID一旦亂舞會議開始,使用下面的代碼使用開始亂舞會議亂舞監聽器會話

Flurry.startSession("FLURRY_API_KEY", with: FlurrySessionBuilder 
       .init() 
       .withCrashReporting(true) 
       .withLogLevel(FlurryLogLevelAll)) 

爲了讓小雪會話ID

Flurry.getSessionID()

如果我們在會話開始後立即調用此方法,將會話Id值設置爲零。

在android中,下面的塊可用於在flurry會話開始時執行,如何在swift中執行同樣的操作。

.withListener(new FlurryAgentListener() {

回答

1
import UIKit 
    import Flurry_iOS_SDK 

    @UIApplicationMain 
    class AppDelegate: UIResponder, UIApplicationDelegate, FlurryDelegate { 

     var window: UIWindow? 


     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
      // Override point for customization after application launch. 


      Flurry.setDelegate(self) 

      let builder = FlurrySessionBuilder.init() 
       .withAppVersion("1.0") 
       .withLogLevel(FlurryLogLevelAll) 
       .withCrashReporting(true) 
       .withSessionContinueSeconds(10) 

      // Replace YOUR_API_KEY with the api key in the downloaded package 
      Flurry.startSession("2WZ22NRSX8W52VKZBX9G", with: builder) 

      return true 
     } 

    /*! 
     * @brief Invoked when analytics session is created 
     * @since 6.3.0 
     * 
     * This method informs the app that an analytics session is created. 
     * 
     * @see Flurry#startSession for details on session. 
     * 
     * @param info A dictionary of session information: sessionID, apiKey 
     */ 

     func flurrySessionDidCreate(withInfo info: [AnyHashable : Any]!) { 

     //your session handling code here 

     } 

下面是截圖突出添加了FlurryDelegate代碼: enter image description here

+0

注意亂舞會話開始擁有API密鑰的 - 而不是一個「會話ID」 - 你會當你創建你的帳戶或創建一個新的應用程序時,在Flurry的網站上創建。 dev.flurry.com – Hunter

+0

感謝您的回覆,我們會盡力讓您知道,是的,我們正在使用API​​密鑰,我只是錯誤地發佈爲會話ID。 – prasad