IIRC,这通常有效.但是最近我注意到NSAssert …()并没有给我堆栈跟踪,或者至少没有用处:
2012-02-26 14:41:19.283 MyApp[3299:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException',reason: '…' *** First throw call stack: (0x33cc58bf 0x353e11e5 0x33cc57b9 0x317583b3 0x78423 0x76e35 0x77dbf 0x217dd 0x12c63 0x3178a943 0x33c99a63 0x33c996c9 0x33c9829f 0x33c1b4dd 0x33c1b3a5 0x3585bfcd 0x34d60743 0xde87 0x30dc) terminate called throwing an exception(gdb) bt #0 0x3629232c in __pthread_kill () #1 0x34b3ef5a in pthread_kill () #2 0x34b37fea in abort () #3 0x35fe9f6a in abort_message () #4 0x35fe734c in default_terminate () #5 0x353e12e2 in _objc_terminate () #6 0x35fe73c4 in safe_handler_caller () #7 0x35fe7450 in std::terminate () #8 0x35fe8824 in __cxa_rethrow () #9 0x353e1234 in objc_exception_rethrow () #10 0x33c1b544 in CFRunLoopRunSpecific () #11 0x33c1b3a4 in CFRunLoopRunInMode () #12 0x3585bfcc in GSEventRunModal () #13 0x34d60742 in UIApplicationMain () #14 0x0000de86 in main (argc=1,argv=0x2fdffaa4) at …/main.mm:18 (gdb)
我在某处读到使用Xcode没有符号的iOS部署目标导致这种情况,我确实最近将设置从4.0更改为4.3.然而,改回来没有任何区别.
OTOH,断言(……)按预期工作.
当NSAssert …()失败时,为什么Xcode不提供正确的可导航堆栈跟踪?