I am used to having a stack trace appear in the console when I don't catch an exception and it throws it back to the main function. Is there a build setting somewhere in Xcode 4.2 that I don't have on? Right now, it shows nothing in the console at all.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Try adding a breakpoint on exception.
- Click on the breakpoint's tab (cmd + 6)
- Click the add ('+') button bottom left.
- Click 'Add Exception Breakpoint...'
- Leave the defaults and click done.
Now when an exception is thrown it should drop you into debugger at the line that throws the exception.
回答2:
This is usually indicative of a problem with LLDB (debugger). I love LLDB, but when it comes to showing stack traces and breaking on the exception rather than main in iOS apps, it's a pain in the ass and has been for a few releases now. No idea why Apple hasn't addressed this yet. To fix it is a two-step process:
- Edit your current scheme and under the "Run" tab change the debugger from LLDB to GDB.
- Go to https://developer.apple.com/bugreporter/ and report the bug so Apple addresses it.