将 Facebook SDK `activateApp` 添加到 `applicationDidBecomeActive`?

Add Facebook SDK `activateApp` to `applicationDidBecomeActive`?

FacebookAutoLogAppEventsEnabled没有设置为false时,是否需要在applicationDidBecomeActive中添加FBSDKAppEvents.activateApp()

根据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 是在 "Manual Event Logging":

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初始化。

基于FBSDKAppEvents.activateApp()FB docs discussion

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。 这不会是警告、错误或违反指南。

如果我给出的论据太少无法证实我的建议。然后,如果有必要,我将以扩展的形式描述我的指导是什么以及我是如何分析采纳这样的意见的。