在会话开始时乱舞的听众

时间:2017-08-09 10:16:20

标签: swift flurry flurry-analytics

一旦flurry会话开始,我需要获得flurry session Id,使用以下代码启动flurry session

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

使用

获取乱舞会话ID

Flurry.getSessionID()

如果我们在会话开始后立即调用此方法,则会话Id值为零。

在android中,以下块可用,当flurry session启动时执行,如何在swift中执行相同操作。

.withListener(new FlurryAgentListener() {

1 个答案:

答案 0 :(得分: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