Question

I am using the PLCrashReporter framework to detect crashes and send those to our back end. There, I convert the PLCrashReport data structure into a JSON object. Now I was wondering how I could unit-test these functionality.

Is there a way to create a PLCrashReport from crash file or from source?

Thank you.

Was it helpful?

Solution

Assuming you're using the PLCrashReport API to actually parse the protobuf report, this is a bit more tricky than it needs to be, mainly because the API necessary to create arbitrary PLCrashReport instances — the only option is to parse an actual report.

Your best bet would be to generate a crash report (eg, via -[PLCrashReporter generateLiveReport]), use it as a static test resource, and write your tests against that known data.

This is a use case we should support better, though, so I've filed a PLCrashReporter issue to track the request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top