【问题标题】:Flurry listener on start of session会话开始时的 Flurry 监听器
【发布时间】:2017-08-16 16:17:28
【问题描述】:

一旦flurry session开始,我需要获取flurry session ID,使用以下代码启动flurry session

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

使用

获取flurry会话ID

Flurry.getSessionID()

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

在android中,当flurry session开始时,下面的块是可用的,如何在swift中做同样的事情。

.withListener(new FlurryAgentListener() {

【问题讨论】:

    标签: swift flurry flurry-analytics


    【解决方案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 添加的代码:

    【讨论】:

    • 请注意,Flurry 会话是使用 api 密钥启动的,而不是“会话 id”,当您创建帐户或创建新应用程序时,您将在 Flurry 的网站上创建该密钥。 dev.flurry.com
    • 感谢您的回复,我们会尽力让您知道,是的,我们正在使用 API 密钥,我只是错误地发布为 Session Id。
    猜你喜欢
    • 2013-02-12
    • 1970-01-01
    • 2012-12-13
    • 2015-12-09
    • 1970-01-01
    • 2019-03-10
    • 1970-01-01
    • 2013-11-01
    • 2018-11-28
    相关资源
    最近更新 更多