PLCrashReporter - how to convert .plcrash to .crash directly from Xcode itself and save it locally

I am currently working with PLCrashReporter and need some help converting plcrash directly to a .crash file instead of using plcrashutil.

What I'm doing right now is

I simulate a failure and it creates the file myapp.plcrash.

Once this is generated, I use the following on the command line:

plcrashutil convert --format=iphone myapp.plcrash > app.crash 

It works great. But is there a way that I cannot take this extra step and convert it to .crash directly from my code, possibly by importing a library or something like that.

Any solutions ???

+8
iphone crash
source share
2 answers

Got an answer

Here is the solution if someone is looking for it.

 PLCrashReportTextFormat textFormat = PLCrashReportTextFormatiOS; /* Decode data */ PLCrashReport *crashLog = [[PLCrashReport alloc] initWithData: data error: &error]; if (crashLog == nil) { NSLog(@"Could not decode crash file :%@", [[error localizedDescription] UTF8String]); } else { NSString* report = [PLCrashReportTextFormatter stringValueForCrashReport: crashLog withTextFormat: textFormat]; NSLog(@"Crash log \n\n\n%@ \n\n\n", report); NSString *outputPath = [documentsDirectory stringByAppendingPathComponent: @"app.crash"]; if (![report writeToFile:outputPath atomically:YES encoding:NSUTF8StringEncoding error:nil]) { NSLog(@"Failed to write crash report"); } else { NSLog(@"Saved crash report to: %@", outputPath); } } 
+16
source share

Have you tried to symbolize the .crash file in a new format?

0
source share

All Articles