Get previous run, crash logs on iPhone

后端 未结 4 1717
天命终不由人
天命终不由人 2020-12-13 16:32

I trying to write a a crash report feature that when you launch the app after a crash, it will offer to send the crash report to the server. I can\'t find how to get the cra

4条回答
  •  暖寄归人
    2020-12-13 17:30

    I had this similar issue and the PLCrashReported seemed too complicated for what I wanted to do. Note that you can't access the crash report generated by Apple, the PLCrashReport generates it's own reports and store them in the user's cache folder.

    Eventually, I used the following example: http://cocoawithlove.com/2010/05/handling-unhandled-exceptions-and.html

    it's very simple and easy to use, just register exception and signal handlers using:

    NSSetUncaughtExceptionHandler(&HandleException);
    signal(SIGABRT, SignalHandler);
    signal(SIGILL, SignalHandler);
    signal(SIGSEGV, SignalHandler);
    signal(SIGFPE, SignalHandler);
    signal(SIGBUS, SignalHandler);
    signal(SIGPIPE, SignalHandler);
    

    and get the stack trace using the backtrace method in UncaughtExceptionHandler class.

提交回复
热议问题