iosflutterfirebasecrashlytics

How to comply with Apple's "describing use of required reason API" when using Firebase Crashlytics in a Flutter app?


After 1st May 2024 apps submitted to Apple's App Store must comply with Describing use of required reason API. While preparing my Flutter app to meet these requirements I could not find out how to do this when using Firebase Crashlytics. Specifically this part is troubling me (quoted from the above link):

Disk space APIs

...

7D9E.1

Declare this reason to include disk space information in an optional bug report that the person using the device chooses to submit. The disk space information must be prominently displayed to the person as part of the report.

Information accessed for this reason, or any derived information, may be sent off-device only after the user affirmatively chooses to submit the specific bug report including disk space information, and only for the purpose of investigating or responding to the bug report.

Firebase Crashlytics does collect and send information like this, if I check some existing events in the Firebase Console, I can see RAM free among other items under the Data section of an event.

If I understand correctly it is not enough to ask for the user's permission to send bug report data in general. According to the quote above I have to specifically ask for permission on each bug report and also display the content of the report, including free memory.

How to do that with Firebase Crashlytics in a Flutter application? (Crashlytics itself is properly added to my app and works fine, I can see test and real bug reports in the console.).

  1. I know that I can disable automatic Crashlytics data collection about bugs and switch it on and off for a specific user as detailed here.

  2. I know that if I disable automatic collection I can check for unsent Crashlytics reports using checkForUnsentReports.

  3. I know that depending on the user's choice I can either send the reports with sendUnsentReports or delete these using deleteUnsentReports.

I tried to implement the solution based on the previous steps and I was expecting that I will have access to all of the data collected in the bug report, including free space. My plan was to display these to the user as required by Apple and offer the choice to send or discard the bug reports.

But it turned out I can't access this information, I can only send or delete all unsent bug reports.

I also tried to get this information from where my code calls FirebaseCrashlytics.instance.recordFlutterFatalError and FirebaseCrashlytics.instance.recordError, but I found out I can get only the error details and stacktrace from here.


Solution

  • The required reason API discussed in the question was removed in Firebase 10.22.0, so updating to a newer SDK version is an option.

    Firebase 10.22.0 corresponds with firebase_core 2.26.0 (changelog) and firebase_crashlytics 3.4.17.