0

After doing some research, I've tried these and here's what I've got:

I found out that crash logs are put in this folder:

/var/mobile/Library/Logs/CrashReporter/

With this information, I tried to:

Get files under this path by using

[[NSFileManager defaultManager]  contentsOfDirectoryAtPath:crashReportPath error:&error];

But I always get NSCocoaErrorDomain 257, which means I don't have the permission.

Therefore, I tried to set permission to this folder by using

NSFileManager *manager = [NSFileManager defaultManager];
NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithDictionary:[manager attributesOfItemAtPath:crashReportPath error:nil]];
[attributes setValue:[NSNumber numberWithShort:0777] forKey:NSFilePosixPermissions];; // chmod permissions 777
[manager setAttributes:attributes ofItemAtPath:crashReportPath error:&error];

But I always get NSCocoaErrorDomain 513 NSFileWriteNoPermissionError which means I don't have the permission to write.

Without luck, I've tried this post: iPhone sdk read crash files programmatically? to handle the unhandled exceptions by setting NSSetUncaughtExceptionHandler but this seemed to have some problems since sometimes the application might be left in an unstable or invalid state.

I know there are many third-party crash report plugins but most of them just generate its report of certain signals monitored, not the real crash reports.

Any suggestions on getting the real crash report? Is there any other way around?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Joanne
  • 1,226
  • 13
  • 15

1 Answers1

0

I found the best way to implement crash reporting on our own server.

Implement this Crash Manager with your project it will give you maximum possible crashes and you can upload crash reports to your own server.

Or else you can also do without using of any library or third party code. Refer this - How can we store crash logs in iOS application

sohan vanani
  • 1,537
  • 1
  • 20
  • 37