使用NSAssert()
拋出在iPad設備上運行的Objective-C的應用NSInternalInconsistencyException
異常後(在調試模式下進行編譯),我得到類似的東西:Objective-C的堆棧跟蹤
2012-05-27 02:31:36.830 appname[10821:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'reason'
*** First throw call stack:
(0x3800788f 0x33338259 0x38007789 0x371f13a3 0x791a1 0x79555 0x79e03 0x7a44d 0x798d3 0x737fd 0x30e19c8b 0x30e18461 0x30e0ae87 0x30e7b7d5 0x30e18e6d 0x30e127dd 0x30de0ac3 0x30de0567 0x30ddff3b 0x3644122b 0x37fdb523 0x37fdb4c5 0x37fda313 0x37f5d4a5 0x37f5d36d 0x30e1186b 0x30e0ecd5 0x7343f 0x733e4)
terminate called throwing an exception
哪有我發現一個有用的堆棧跟蹤,它給了我至少一個簡單列表,所有的函數被調用,直到拋出異常?
Xcode中並沒有幫助:
http://i47.tinypic.com/xax4l0.png
bt
在lldb
顯示:
(lldb) bt
* thread #1: tid = 0x1c03, 0x30c6832c libsystem_kernel.dylib`__pthread_kill + 8, stop reason = signal SIGABRT
frame #0: 0x30c6832c libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x331f920e libsystem_c.dylib`pthread_kill + 54
frame #2: 0x331f229e libsystem_c.dylib`abort + 94
frame #3: 0x37682f6a libc++abi.dylib`abort_message + 46
frame #4: 0x3768034c libc++abi.dylib`_ZL17default_terminatev + 24
frame #5: 0x33338356 libobjc.A.dylib`_objc_terminate + 146
frame #6: 0x376803c4 libc++abi.dylib`_ZL19safe_handler_callerPFvvE + 76
frame #7: 0x37680450 libc++abi.dylib`std::terminate() + 20
frame #8: 0x37681824 libc++abi.dylib`__cxa_rethrow + 88
frame #9: 0x333382a8 libobjc.A.dylib`objc_exception_rethrow + 12
frame #10: 0x37f5d50c CoreFoundation`CFRunLoopRunSpecific + 404
frame #11: 0x37f5d36c CoreFoundation`CFRunLoopRunInMode + 104
frame #12: 0x30e1186a UIKit`-[UIApplication _run] + 550
frame #13: 0x30e0ecd4 UIKit`UIApplicationMain + 1080
frame #14: 0x0007343e appname`main + 86 at main.m:5
這是更好的,但仍然不是非常有用的。我仍然不知道是什麼導致拋出異常。
在調試窗口中鍵入'bt'會給你什麼? – lnafziger
@lnafziger,更新了問題。 – rid