我创建了一些示例代码来演示我的问题。
当我调用测试方法时,没有堆栈跟踪。调试器只会停在main.m上,并突出显示此行。
- (void) test {
void (^handler)(void) = ^ {
NSArray *test = [NSArray array];
[test objectAtIndex: 5];
};
handler = [handler copy];
dispatch_async(dispatch_get_main_queue(), handler);
}
当我调用测试方法时,没有堆栈跟踪。调试器只会停在main.m上,并突出显示此行。
int retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([FantasyUniversalAppDelegate class]));
如果我去掉dispatch_async,直接调用handler()函数,则可以获得堆栈跟踪。有人能解释一下这是为什么吗?是否有办法获得更详细的堆栈跟踪?
目前,我正在使用Flurry来显示崩溃信息,但它显示给我的崩溃信息并不是很有用,因为我得到的堆栈跟踪非常不具描述性(已被符号化)。它看起来像这样:
Thread: Unknown Name
0 libsystem_kernel.dylib 0x3a224eb4 mach_msg_trap + 20
1 CoreFoundation 0x32067045 __CFRunLoopServiceMachPort + 129
2 CoreFoundation 0x32065d5f __CFRunLoopRun + 815
3 CoreFoundation 0x31fd8ebd CFRunLoopRunSpecific + 357
4 CoreFoundation 0x31fd8d49 CFRunLoopRunInMode + 105
5 GraphicsServices 0x35b9c2eb GSEventRunModal + 75
6 UIKit 0x33eee301 UIApplicationMain + 1121
7 IOSTestApp 0x00025d7b main (main.m:14)