象征性崩溃只给了我__PRETTY_FUNCTION__

时间:2013-01-15 19:48:14

标签: ios crash-reports crash-dumps uncaught-exception symbolicate

我已将此代码用作我的应用的UncaughtExceptionHandler,以捕获一些崩溃信息并将其返回给我:

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来表示报告中的内存地址,但3个地址0x0013f1f1 0x001285ed 0x0012887d只返回__PRETTY_FUNCTION__.20480 (in myapp) + 101235 __PRETTY_FUNCTION__.20480 (in myapp) + 8047 {{1}这对我没有帮助。 我还能做些什么来至少找到导致崩溃的方法名称吗?

如果没有,有什么我可以添加到我的__PRETTY_FUNCTION__.20480 (in myapp) + 8703或在将来的版本中为我提供方法名称吗?我似乎从来没有得到任何iTunes Connect崩溃报告,这就是我采用这条路线的原因。

由于

1 个答案:

答案 0 :(得分:3)

为了获得更好的崩溃报告而需要考虑的一些服务/库是。

  • Crashlytics我强烈推荐,删除简单的设置,漂亮的界面和自动符号
  • TestFlight我爱 TestFlight for beta发行版,我没有多少经验 他们的崩溃报告工具
  • QuincyKit如果您愿意,这很好 托管你自己的服务器来接收报告,如果你不喜欢乱七八糟 与服务器托管签出HockeyApp这是“托管” 版本HockeyKit + QuincyKit
  • JIRA Mobile Connect如果您使用JIRA

使用其中一个可以让你忘记未经规范的异常的复杂性,他们是专家。除非你有兴趣成为这个领域的专家,否则我真的建议你选择其中一个。我知道这不能回答你问题的第一部分,但希望如果你无法得到答案或想花时间研究它,它会提供一些价值。

相关问题