9

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

What i currently do is -

I simulate a crash and it creates a myapp.plcrash file.

Once that is generated i use the following on command line -

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

This works perfectly - But is there a way I can dont have to do this extra step and convert it to .crash directly from my code probably by importing the library or something??

Any Solutions???

4

2 に答える 2

17

答えを得た

他の誰かがそれを探しているなら、ここに解決策があります..

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);
        }

    }
于 2011-11-16T18:35:15.633 に答える
0

.crash ファイルを新しい形式でシンボル化しようとしましたか?

于 2012-07-25T19:38:18.220 に答える