Read the iOS app file programmatically.

As I understand it, when an iOS application crashes, the system creates a .crash file that can be accessed through Xcode. Can this file be read programmatically from within the application itself?

I intend to send this crash log (if it exists) to the server so that we can analyze the log without user intervention. There are several crash reporting services (eg bugsense, crashlytics) that can do this, so I'm guessing a custom implementation should be possible?

Hooray!

+3


source to share


1 answer


It is not possible to read the crash report generated by the iOS system from your application. The reason is that your application is running in a sandbox and has no access to anything other than its own sandbox. Therefore, if you try to read a file or directory from a path that is not in your sandbox, you will not get any data.

The only option for getting crash reports is to add a library to your code that can detect crashes, generate reports and send them in some way. Most send it to the server as it is not very efficient to receive thousands of crash reports by email, also considering the symbolization process required to get class, method and line number information.

A popular and safe to use open source library is PLCrashReporter . Most services use this, some of them create their own functions to achieve the functionality. There is an open source application to compare different services and crash reporting libraries called CrashProbe (Disclaimer: I am one of its developers). The project has a website http://crashprobe.com with a list of already compared services.



It is also important to note that having a dedicated crash reporting library is not enough for good crash reporting, as the symbology process needs to be able to translate the information in the crash report to tell you the correct class name, method name, filename, and line number for each frame in stack trace.

I would recommend comparing the services that seem to suit your needs (using CrashProbe as well) and then deciding which one is best for your use.

I will not recommend any services as this is not permitted according to stackoverflow guidelines .

+6


source







All Articles