Reputation: 11
I want use the "plcrashreporter" library on Xcode Debugger Mode.
I add "plcrashreporter" to my testAPP, and run, because of this code if (debugger_should_exit())
,testAPP crash.I know because the debugger catches all crashes instead of the CrashReporter doing it.Then I open the app directly through the simulator.it's worked.
but,can't debugger in Xcode is inconvenient. I guess the demo on Debugger be crashed because author dosomething like debugger_should_exit()
.maybe also use the falg P_TRACED
.I try to modify related places,but also crash,and the Console log:
[PLCrashReport] PLCrashMachExceptionForward:648: Unsupported exception behavior: 0x1 (MACH_EXCEPTION_CODES=true)
[PLCrashReport] plframe_cursor_read_compact_unwind:66: Could not find a loaded image for the current frame pc: 0x7fff6224f35b
[PLCrashReport] grow:121: WARNING: Growing the AsyncAllocator free list via vm_allocate(). Increasing the initial size of this allocator is recommended.
[PLCrashReport] plcrash_writer_write_signal:1143: Warning -- unhandled signal sicode (signo=9, code=0). This is a bug.
I found a app had solve this,but I don't know how.Please help me,thx.
Upvotes: 1
Views: 1529
Reputation: 509
Are you looking to debug through the application or is it to just view logs?
You can run change your run schema to disable debug mode, this will allow you to view the log output of your app. Because debug mode is now disabled PLCrashReporter will now run. You can format the print of your crash report and see it's log contents.
guard let crashData = try? crashReporter.loadPendingCrashReportDataAndReturnError(), let reportData = try? PLCrashReport(data: crashData), !report.isKind(of: NSNull.classForCoder()) else {
crashReporter.purgePendingCrashReport()
return
}
let crash: NSString = PLCrashReportTextFormatter.stringValue(for: reportData, with: PLCrashReportTextFormatiOS)! as NSString
print("Crash report:\n \(crash)")
Upvotes: 1