Completely disable Firebase/Analytics to stop console spam on app startup

后端 未结 3 824
醉梦人生
醉梦人生 2020-12-09 08:55

I\'ve installed Google/SignIn cocoapod into my application (which I need to support GoogleDrive), but it depends on Google/Core which depends on FirebaseAnalytics. I don\'t

相关标签:
3条回答
  • 2020-12-09 09:19

    You can find this buried in the output:

    <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging
     set the following application argument: -FIRAnalyticsDebugEnabled
    

    Disabling is the opposite - set the argument: -noFIRAnalyticsDebugEnabled:

    Additionally, you can control the default Firebase logging level with the setLoggerLevel method in FIRConfiguration. For example to disable all Firebase logging:

      [[FIRConfiguration sharedInstance] setLoggerLevel:FIRLoggerLevelMin];
      [FIRApp configure];
    

    or in Swift:

    FirebaseConfiguration.shared.setLoggerLevel(FirebaseLoggerLevel.min)
    FirebaseApp.configure()
    

    More details in the FIRLogger implementation here

    0 讨论(0)
  • 2020-12-09 09:22

    To the best of my knowledge, these two lines:

    [[FIRConfiguration sharedInstance] setLoggerLevel:FIRLoggerLevelMin];
    [[FIRAnalyticsConfiguration sharedInstance] setAnalyticsCollectionEnabled:NO];
    

    placed very early in the app delegate's didFinishLaunchingWithOptions: will completely disable FireBase analytics, including stopping all the console output.

    I've also since discovered that the Google/SignIn cocoapod is deprecated - the recommended one to use is GoogleSignIn (ie. no '/'). If you use GoogleSignIn, then this doesn't have a dependency on Firebase Analytics, so the original problem goes away. Now I have Google Drive support in my app and don't have Firebase Analytics!

    0 讨论(0)
  • 2020-12-09 09:25

    Swift 4.0:

    FirebaseConfiguration.shared.setLoggerLevel(.min) FirebaseConfiguration.shared.analyticsConfiguration.setAnalyticsCollectionEnabled(false)

    0 讨论(0)
提交回复
热议问题