How to force Crashlytics to upload reports & wait

Viewed 1396

On some user devices, my iOS app crashes repeatedly on startup. That makes it impossible for crashlytics to upload the reports on every startup. Is there a way to get the callback that Crashlytics has completed uploading reports and then proceed with view controller initialisation tasks? Is there a way to know when the app starts:

  • Crashlytics has pending crash reports to be uploaded on startup

  • If yes, wait for the upload to finish before proceeding to view controller setup

1 Answers

I recommend checking out this doc: https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=ios#the_crashlyticsdelegate_is_replaced_by_separate_methods_for_handling_crash_reports

Specifically this section:

"By default, Crashlytics automatically uploads crash reports at startup, and you could previously call didFinishLaunchingWithOptions to let your users opt-in to crash reporting. Now, when you call setCrashlyticsCollectionEnabled=false to turn off automatic crash reporting, Crashlytics calls checkForUnsentReportsWithCompletion, which lets your users choose whether or not to send crash reports when your app crashes. You can then call sendUnsentReports if the user opts in or deleteUnsentReports if the user opts out.

Note that you can also call sendUnsentReports and deleteUnsentReports outside of checkForUnsentReportsWithCompletion. For example, you may want to permanently set up or disable crash reporting if your users have given you blanket approval or disapproval to send crash reports. Keep in mind that you may never receive crash reports if your app crashes early on in its lifecycle."

Related