我已經使用這個代碼作爲UncaughtExceptionHandler
我的應用程序來捕捉一些崩潰信息,然後返回給我:Symbolicating崩潰只是給了我__PRETTY_FUNCTION__
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]];
}
今天收到崩潰報告相比是相當小到你從iTunes Connect獲得的音樂。它看起來像這樣:
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
我已經使用ATOS到symbolicate報告中的內存地址,但3個地址0x0013f1f1
0x001285ed
0x0012887d
只是返回__PRETTY_FUNCTION__.20480 (in myapp) + 1
__PRETTY_FUNCTION__.20480 (in myapp) + 8047
__PRETTY_FUNCTION__.20480 (in myapp) + 8703
它並沒有真正幫助我。 還有什麼我可以做,至少找到導致崩潰的方法名稱?
如果沒有,有什麼我可以添加到我的UncaughtExceptionHandler
或在未來的版本中,會給我的方法名稱嗎?我似乎從來沒有得到任何iTunes Connect崩潰報告,這就是爲什麼我採取了這條路線。
謝謝
更好地使用經過驗證的Crash Reporting開源庫,比如PLCrashReporter或基於它的任何基於它的標準崩潰報告:https://code.google.com/p/plcrashreporter/ – Kerni