9

I just downloaded compiled and added PLCrashReporter to my app. I've tested it and it works fine. The sample code from the project documentation works fine.

Now, I'd like to generate a stacktrace such that I can see where exactly the app crashed. Something you would get if you look into the iphone device logs when you connect your iphone to xcode: Sample crash report from the iphone device logs

What do I have to do to get such a nice stacktrace generated with PLCrashReporter?

toom
  • 12,864
  • 27
  • 89
  • 128

2 Answers2

17

The framework includes a text formatter in PLCrashReportTextFormatter.h:

NSString *humanReadable = [PLCrashReportTextFormatter stringValueForCrashReport:report withTextFormat:PLCrashReportTextFormatiOS];
NSLog(@"Report: %@", humanReadable);
augusto callejas
  • 509
  • 3
  • 12
  • Thanks for the answer. This prints a stacktrace. But the recieved stacktrace just contains memory addresses. This is not what I'm looking for. – toom Oct 20 '12 at 14:40
  • Did you get answer for this yet? – Abhinandan Sahgal Feb 27 '13 at 12:53
  • Above code works perfectly with new version PLCrashReporter.It's print with method name and line number. – Yashesh May 01 '13 at 04:34
  • 1
    hi, i tried the PLCrashReportTextFormatter using latest PLCrashReporter, it only gives me "Application Specific Info"...threads info..."binary images".. no function name or line numbers are to be seen. Why? – mkto Jun 27 '13 at 06:31
  • This is generally the case because the application was build without symbols. This is the default case for release builds. Look into "symbolicating iOS crash logs". That should point you in the right direction. (Kerni talks about it a bit in his answer) – parKing Jul 17 '13 at 12:40
  • 1
    how to get class name and method name ? i am not able to do that.. please help me – Apple Sep 19 '13 at 07:11
  • I can't find the PLCrashReportTextFormatter.h in my framwork. I have integrated the PLCrashReporter via Pods. can you provide the link – Qadir Hussain Jan 12 '16 at 11:52
  • I have changed the build settings not to strip debug symbols. However the crash text formatter still doesn't show the method names. Any ideas? – rukiman Jun 03 '19 at 06:07
3

You need to symbolicate the crash report by using the symbolicatecrash tool which is part of Xcode. This requires the dSYM package of the exact build that created the crash report to be available. There are multiple discussion on how to do that on StackOverflow.

There are also 3rd party services which do that automatically for you, including collecting the crash reports and grouping them by similarities, and also the open source project QuincyKit with a PHP server part that helps you to collect crash reports and automate symbolication from your own Mac.

Kerni
  • 15,241
  • 5
  • 36
  • 57