I have used this code as an UncaughtExceptionHandler
for my app to capture some crash information and return it back to me:
NSArray *callStack = [exception callStackReturnAddresses];
int i,len = [callStack count];
// void **frames = new void *[len];
void **frames = (void**)malloc(len);
for (i = 0; i < len; ++i) {
frames[i] = (void *)[[callStack objectAtIndex:i] unsignedIntegerValue];
}
char **symbols = backtrace_symbols(frames,len);
/*
* Now format into a message for sending to the user
*/
NSMutableString *buffer = [[NSMutableString alloc] initWithCapacity:4096];
NSBundle *bundle = [NSBundle mainBundle];
[buffer appendFormat:@"Version %@\n\n",[bundle objectForInfoDictionaryKey:@"CFBundleVersion"]];
[buffer appendFormat:@"Device: %@. OS: %@\n", [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion]];
[buffer appendString:@"Uncaught Exception\n"];
[buffer appendFormat:@"Exception Name: %@\n",[exception name]];
[buffer appendFormat:@"Exception Reason: %@\n",[exception reason]];
[buffer appendString:@"Stack trace:\n\n"];
for (i = 0; i < len; ++i) {
[buffer appendFormat:@"%4d - %s\n",i,symbols[i]];
}
Today I received a crash report which is quite minimal compared to the ones you get from iTunes Connect. It looks like this:
0 - 0 CoreFoundation 0x395472a3 + 162
1 - 1 libobjc.A.dylib 0x3343697f objc_exception_throw + 30
2 - 2 CoreFoundation 0x395471c5 + 0
3 - 3 Foundation 0x342ec7cb + 66
4 - 4 myapp 0x0012887d myapp + 424061
5 - 5 myapp 0x001285ed myapp + 423405
6 - 6 myapp 0x0013f1f1 myapp + 516593
7 - 7 libdispatch.dylib 0x3783a11f + 10
8 - 8 libdispatch.dylib 0x378394b7 + 22
9 - 9 libdispatch.dylib 0x3783e1bd + 224
10 - 10 CoreFoundation 0x3951af3b + 1290
11 - 11 CoreFoundation 0x3948debd CFRunLoopRunSpecific + 356
12 - 12 CoreFoundation 0x3948dd49 CFRunLoopRunInMode + 104
13 - 13 GraphicsServices 0x3785b2eb GSEventRunModal + 74
14 - 14 UIKit 0x326cd2f9 UIApplicationMain + 1120
15 - 15 myapp 0x000e72e7 myapp + 156391
16 - 16 myapp 0x000c2530 myapp + 5424
I have used atos to symbolicate the memory addresses in the report but the 3 addresses 0x0013f1f1
0x001285ed
0x0012887d
just return __PRETTY_FUNCTION__.20480 (in myapp) + 101235
__PRETTY_FUNCTION__.20480 (in myapp) + 8047
__PRETTY_FUNCTION__.20480 (in myapp) + 8703
which doesn't really help me.
Is there anything else I can do to at least find the method name that caused the crash?
If not, is there anything I can add to my UncaughtExceptionHandler
or do in a future release that will give me the method names? I never seem to get any iTunes Connect crash reports which is why i've taken this route.
Thanks