在 Xcode 上开启 Firebase Analytics

我试图测试我的 Firebase Analytics 的实现。在他们的 文件中,他们声明:

方法启用调试模式 您可以在应用程序的 Xcode 中添加此参数 当通过 -FIRDebugEnable 启用调试模式时,进一步 应用程序的执行也将处于调试模式 返回到默认模式时,必须显式禁用调试模式 带有应用程序参数 -FIRDebugDisable。

不幸的是,我不明白我在哪里设置这个计划。在 Android 中,这很容易。我们会感激你的帮助。

57463 次浏览

I have found the answer on this alternative page of Google:

https://firebase.google.com/docs/analytics/ios/start

  1. In Xcode, select Product > Scheme > Edit scheme...
  2. Select Run from the left menu.
  3. Select the Arguments tab.
  4. In the Arguments Passed On Launch section, add -FIRAnalyticsDebugEnabled.

I wish Google would stop releasing half baked products and documentation. Could save hundreds of thousands of hours worldwide

I tried editing scheme and adding parameters, https://firebase.google.com/docs/analytics/ios/start but it did not work for me. In addition, I added following code after configuring FirebaseApp, at AppDelegate, didFinishLaunchingWithOptions

    FirebaseApp.configure()
Analytics.setAnalyticsCollectionEnabled(true)

and it worked for me. I hope it helps you too.

I think you should check console log on XCode. Because I will show log

To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see https://help.apple.com/xcode/mac/8.0/#/dev3ec8a1cb4)

Check again, if you don't:

  • Add key FirebaseCrashlyticsCollectionEnabled has value true in Info.plist
  • set key IS_ANALYTICS_ENABLED is true in GoogleService-Info.plist
  • Make sure file GoogleService-Info.plist add will all targets and save in root project