Skip to content

FR: Add an API to generate plain text crash report. #9853

Open
@wangjiejacques

Description

@wangjiejacques

Feature proposal

  • Firebase Component: Crashlytics

Describe your use case and/or feature request here.

The plcrashreporter has APIs to allow us to get the crash report as plain string, I was wondering if Crashlytics can provide us something similar.

  // Try loading the crash report.
  if crashReporter.hasPendingCrashReport() {
    do {
      let data = try crashReporter.loadPendingCrashReportDataAndReturnError()

      // Retrieving crash reporter data.
      let report = try PLCrashReport(data: data)

      // We could send the report from here, but we'll just print out some debugging info instead.
      if let text = PLCrashReportTextFormatter.stringValue(for: report, with: PLCrashReportTextFormatiOS) { 
        print(text)
      } else {
        print("CrashReporter: can't convert report to text")
      }
    } catch let error {
      print("CrashReporter failed to load and parse with error: \(error)")
    }
  }

  // Purge the report.
  crashReporter.purgePendingCrashReport()

Use Case

We are planing to build our own crash reporter for our customers, but a lot of them already using FirebaseCrashlytics (we don't want to stop them using it), and for now It is not recommended to use multiple crash reporters in iOS, so instead of creating our own crash/exception/signal handler, we want to get the crash report directly from FirebaseCrashlytics and send it to our server.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions