6

I want to implement the in-app crash log creation and get it from the user once the app was crashed. So, I looked about PLCrashReport and tried to add in my app. There are so many links I found to download this framework. Like Google code, Github.

I really dont know which file I should download. It shows some kind of binary releas, source release, lots of PLCrashReporters..

Does someone can pointout the way to add the PLCrashReporter in my app?

Thanks in Advance

Confused
  • 3,846
  • 7
  • 45
  • 72
  • Find an active repo you like on GH, click "Clone in Mac", or Zip. Simple. All roads point to profit. – CodaFi Dec 11 '12 at 07:19
  • The problem here is finding the original PLCrashReport.It shows lots and lots of PLCrashReporters with various size. :( – Confused Dec 11 '12 at 07:22
  • It depends on your personal preference. If you want the bleeding edge, or the first party component, then go with the Google Code download, else, just pick a GitHub repo and download that sucker. They're all PLCrashReporter, just at various stages of development. – CodaFi Dec 11 '12 at 07:25
  • Thank you for the info. Can you share any link that gives the information about the set-up for PLCrashReporter? – Confused Dec 11 '12 at 07:28
  • 1
    Move the unzipped-zipball directory into your project's directory, then add it's Xcode project as a subproject, and link against the framework. Google any of the terms in this comment, and a suitable tutorial for subproject frameworks should come up. – CodaFi Dec 11 '12 at 07:30
  • Is there any official site available that demonstrate how to add the PLCrashReporter in our app? – Confused Dec 11 '12 at 08:55
  • The test command line app shows how to basically integrate it: http://code.google.com/p/plcrashreporter/source/browse/Source/Crash%20Demo/main.m You should think about how you want to collect, symbolicate and group the incoming data. There are multiple open source frameworks and services on top of PLCrashReporter that do various of those things. – Kerni Dec 11 '12 at 15:34

1 Answers1

10

An example of how to integrate PLCrashReporter was shown here (archived):

//
// Called to handle a pending crash report.
//
- (void) handleCrashReport {
    PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter];
    NSData *crashData;
    NSError *error;
    // Try loading the crash report
    crashData = [crashReporter loadPendingCrashReportDataAndReturnError: &error];
    if (crashData == nil) {
        NSLog(@"Could not load crash report: %@", error);
        goto finish;
    }
    // We could send the report from here, but we'll just print out
    // some debugging info instead
    PLCrashReport *report = [[[PLCrashReport alloc] initWithData: crashData error: &error] autorelease];
    if (report == nil) {
        NSLog(@"Could not parse crash report");
        goto finish;
    }
    NSLog(@"Crashed on %@", report.systemInfo.timestamp);
    NSLog(@"Crashed with signal %@ (code %@, address=0x%" PRIx64 ")", report.signalInfo.name,
          report.signalInfo.code, report.signalInfo.address);
    // Purge the report
finish:
    [crashReporter purgePendingCrashReport];
    return;
}
// from UIApplicationDelegate protocol
- (void) applicationDidFinishLaunching: (UIApplication *) application {
    PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter];
    NSError *error;
    // Check if we previously crashed
    if ([crashReporter hasPendingCrashReport])
        [self handleCrashReport];
    // Enable the Crash Reporter
    if (![crashReporter enableCrashReporterAndReturnError: &error])
        NSLog(@"Warning: Could not enable crash reporter: %@", error);
}
armcknight
  • 149
  • 6
snb
  • 171
  • 5
  • Any example for mac os x please? as to how to use framework in the cocoa based apps ? – Ahmed Jul 08 '13 at 14:21
  • what are header files need to be defined? – erdemgc Dec 12 '13 at 09:51
  • Are there any header files to be imported? I have added the framework in my project. But As soon as I paste the code for crash, it shows "Use of undeclared identifier 'PLCrashReporter'". Please help.. – manish_kumar May 28 '15 at 09:40
  • Got it. Found out the header here : http://stackoverflow.com/questions/20540273/plcrashreporter-header-implementation – manish_kumar May 28 '15 at 10:11