2017-08-09 81 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