简体   繁体   中英

How to programmatically disable CrashReporting in current Crashlytics (3.14.*) / Firebase (1.10.*) on iOS

I'd like to enable and disable Crash Reporting in my current iOS app programmatically. I'm using

  • Crashlytics: 3.14.0
  • Fabric: 1.10.2
  • Firebase (Core / Analytics): 6.9.0

The official Firebase documentation at https://firebase.google.com/docs/crash/disable-sdk?hl=en tells me to use the following code:

Crash.sharedInstance().crashCollectionEnabled = false

But this doesn't work / seems to be outdated as

  1. There's no Crash-Class or -Symbol.
  2. There's a Crashlytics class, which seems to be the new Crash-class, but it doesn't have a crashCollectionEnabled property
  3. There seems to be no other API in Crashlytics / Fabric / Firebase to achieve this

I know I could write a custom exception handler and forward received exceptions on demand to Crashlytics, but I don't want to implement such a dirty solution.

Does anybody know a clean way of enabling / disabling Crashlytics in a running iOS app?

for Fabric/Crashlytics: don't call this:

Fabric.with([Crashlytics.self])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM