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?