Get previous run, crash logs on iPhone

后端 未结 4 1714
天命终不由人
天命终不由人 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:27

    I guess I don't have the karma to add a comment to Nimrod Gat's answer, so I have to provide my follow-up here. I'll try to make it worthy of a standalone answer.

    It's very, very difficult to write a safe, correct, and reliable crash reporter, especially one that runs directly in-process. The code referenced in Nimrod Gat's answer is not correct and honestly, that blog post should be retracted. Signal handlers must only run async-safe code, and that code isn't async-safe:

    http://www.cocoadev.com/index.pl?SignalSafety

    Crash handling is even more complicated than normal signal handling, because that you can't expect the process to continue to run successfully after your signal handler returns.

    It's tempting to think you can just hack together a simpler solution, and it will work some of the time, but there's a good reason people like Google's engineers have thousands of LoC dedicated to reliable crash reporting:

    http://code.google.com/p/google-breakpad/

    On iOS, you should just use PLCrashReporter. On other platforms (such as Mac OS X) you should use Google Breakpad. There's no point in re-inventing this wheel unless you're going to do it not only correctly, but better than what already exists.

提交回复
热议问题