gpt4 book ai didi

ios - 将 Facebook SDK `activateApp` 添加到 `applicationDidBecomeActive` 吗?

转载 作者:行者123 更新时间:2023-12-01 23:12:43 24 4
gpt4 key购买 nike

FacebookAutoLogAppEventsEnabled未设置为false时,是否需要将FBSDKAppEvents.activateApp()添加到applicationDidBecomeActive

根据FBSDKAppEvents.h,这是没有必要的:

Notifies the events system that the app has launched and, when appropriate, logs an "activated app" event. This function is called automatically from FBSDKApplicationDelegate applicationDidBecomeActive, unless one overrides 'FacebookAutoLogAppEventsEnabled' key to false in the project info plist file. In case 'FacebookAutoLogAppEventsEnabled' is set to false, then it should typically be placed in the app delegates' applicationDidBecomeActive: method.

FB docs 证实了这一点其中添加 activateApp 位于“手动事件日志记录”下:

The process described here for manual event logging with the SDK is provided so that you have the option of controlling when app events are logged. We recommend that you do not disable automatic logging because it may impact how data is collected for your app.

但是Swift Reference它说:

Logging app activations as an app event enables most other functionality and should be the first thing that you add to your app.

那么它应该添加还是为 Swift 应用程序自动调用?

最佳答案

  • FacebookAutoLogAppEventsEnabled - 自动收集应用程序事件。

  • FBSDKAppEvents.activateApp() - 手动发送应用程序事件。它保证无论外部因素如何,事件都会被强制收集,当然前提是SDK使用正确的AppId初始化。

基于FB docs discussion FBSDKAppEvents.activateApp()的:

activateApp will not log an event on every app launch, since launches happen every time the app is backgrounded and then foregrounded.  "activated app" events will be logged when the app has not been active for more than 60 seconds.

这暗示他的内部逻辑很聪明,并不取决于他被调用的方式、地点和频率。

我的观点(如果这对您很重要)是收集应用程序事件进行分析。我建议手动调用 applicationDidBecomeActive 中的 FBSDKAppEvents.activateApp() 方法,并行且独立于自动 FacebookAutoLogAppEventsEnabled。这不会是警告、错误或违反指南的行为。

如果我给出的论据太少来证实我的建议。然后,如果有必要,我会以扩展的形式描述我的指导思想以及我如何分析以采纳这样的观点。

关于ios - 将 Facebook SDK `activateApp` 添加到 `applicationDidBecomeActive` 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51006053/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com