Flurry 启动会话的正确 appDelegate 方法?

发布于 2024-12-22 01:39:42 字数 848 浏览 1 评论 0原文

Flurry 文档建议将 startSession 调用放在 applicationDidFinishLaunching: 中。

这有两个问题...

- (void)applicationDidFinishLaunching:(UIApplication *)application 
{
    [FlurryAnalytics startSession:@"AWESOMEAPIKEY"];

    // ...
}

1) 难道 application:didFinishLaunchingWithOptions: 不是新批准的启动点吗?

2) 这仅在启动时调用一次,但我们不希望用户每次打开或切换回应用程序时都获得会话信息吗?或者 Flurry 是否通过监听某些事件或 NSNotification 自行处理所有这些?


像这样将 startSession 调用放在 applicationDidBecomeActive:applicationWillEnterForeground: 中不是更好吗?

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // ... Flurry AppCircle setup
    [FlurryAnalytics startSession:@"AWESOMEAPIKEY"];

    // ... your setup
}

Flurry docs recommend placing the startSession call in applicationDidFinishLaunching:.

Two problems with this...

- (void)applicationDidFinishLaunching:(UIApplication *)application 
{
    [FlurryAnalytics startSession:@"AWESOMEAPIKEY"];

    // ...
}

1) Isn't application:didFinishLaunchingWithOptions: the new approved launch point?

2) This is only called once on launch, but don't we want session info every time a user opens or switches back to the app? Or does Flurry handle all that on their own by listening to some event or NSNotification?


Wouldn't a better place to put the startSession call be in applicationDidBecomeActive: or applicationWillEnterForeground:, like so?

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // ... Flurry AppCircle setup
    [FlurryAnalytics startSession:@"AWESOMEAPIKEY"];

    // ... your setup
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一抹苦笑 2024-12-29 01:39:42

对于你的情况1)
放置 [FlurryAnalytics startSession:@"SOMESESSIONKEY"]; 的正确位置是

application:didFinishLaunchingWithOptions:

您可以放心地将其放置在那里。我自己完成了此操作,该应用程序在应用程序商店中运行得非常好,并且提供了完美的统计数据。

对于情况 2),当应用程序返回前台时,您的退出将自动恢复,因此您无需在此处进行任何特殊处理。

for your case 1)
correct place to put [FlurryAnalytics startSession:@"SOMESESSIONKEY"]; is

application:didFinishLaunchingWithOptions:

you can place it there without worries. I have done this by myself and the app is working awesome at appstore and providing the stats perfectly.

for case 2), your secession will be automatically resumed when app returns to foreground so you dont have to do any special handling here.

看透却不说透 2024-12-29 01:39:42

我对此也很好奇。我查看了我的应用程序继承的代码,没有在 didbecomeactive、前台等中看到任何混乱的活动。我只在 didfinishlaunchingwithoptions 中看到了startsession。我在 flurry 网站上看到了下面的回复:startsession,但我仍然不明白它是如何工作的,只是 flurry 库在幕后做了什么? @samfisher,你能详细说明一下吗?

“此方法充当 Flurry Analytics 集合的入口点。必须在 applicationDidFinishLaunching 范围内调用它。会话将在应用程序处于前台的期间继续,直到您的应用程序在后台运行 setSessionContinueSeconds: 中指定的时间。如果应用程序将在会话继续的期间恢复,否则将开始新的会话。”

FlurryApi.h 显示 setSessionContinueSeconds 的默认值为 10,所以我猜 Flurry 可以处理它,我只是在寻找更多确认。

http://support.flurry.com/sdkdocs/iOS/interface_flurry_analytics.html#a78b0b92085b38875d51f1ca0d699849a

I was real curious about this too. I looked at my inherited code for my app and didn't see any flurry activity in didbecomeactive, foreground, etc. I only saw the startsession in didfinishlaunchingwithoptions. I saw the below on the flurry site re: startsession, but i still don't get how it works, just behind the scenes stuff the flurry library does? @samfisher, can you elaborate?

"This method serves as the entry point to Flurry Analytics collection. It must be called in the scope of applicationDidFinishLaunching. The session will continue for the period the app is in the foreground until your app is backgrounded for the time specified in setSessionContinueSeconds:. If the app is resumed in that period the session will continue, otherwise a new session will begin."

FlurryApi.h shows the default as 10 for setSessionContinueSeconds so I guess Flurry handles it, I'm just looking for more confirmation.

http://support.flurry.com/sdkdocs/iOS/interface_flurry_analytics.html#a78b0b92085b38875d51f1ca0d699849a

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文