How to get iPhone crash log from customers?

You can perform your own crash-logging with PLCrashReporter. Typically, you write the crash log to a file and then send it to a server the next time the app starts.

In order to prevent an infinite crash-reporting loop (there was one in an early version), you want to do things in a specific order:

  1. Read the file to memory and delete it. (Hopefully this won’t crash.)
  2. Parse the crash report and send it to the server. (If it crashes now, the file has been deleted, so it shouldn’t happen again.)
  3. Finally, enable crash reporting (so if it crashes in steps 1 or 2, the crash isn’t logged).

In any case, you should have a “Oops, it crashed! Do you want to send a crash report?” dialog. I think automatic crash-logging is permitted by the default EULA, but it doesn’t hurt to be nice to your users.

If you’re worried about losing reports forever if the user says “no”, instead of deleting the report, you can do logrotate-style style renaming (i.e. rename report8 to report9, rename report7 to report8, …, rename report to report0). Then have a “send last N crash reports” button (either set N=10 or count the number of reports), so even if they’ve accidentally disabled it (or they had no internet at the time), they can still send the report.

Leave a Comment