Xcode 堆栈跟踪未出现在控制台中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7960816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode stack trace not appearing in console
提问by Samuel Hicks
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.
我习惯于在没有捕获异常时在控制台中显示堆栈跟踪并将其抛回主函数。Xcode 4.2 中的某处是否有我没有的构建设置?现在,它在控制台中根本没有显示任何内容。
回答by Paul.s
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.
- 单击断点的选项卡 (cmd + 6)
- 单击左下角的添加 ('+') 按钮。
- 单击“添加异常断点...”
- 保留默认值并单击完成。
Now when an exception is thrown it should drop you into debugger at the line that throws the exception.
现在,当抛出异常时,它应该让您在抛出异常的行中进入调试器。
回答by memmons
This is usuallyindicative 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:
这通常表示LLDB(调试器)存在问题。我喜欢 LLDB,但是当涉及到在 iOS 应用程序中显示堆栈跟踪和打破异常而不是主要时,这很麻烦,现在已经有几个版本了。不知道为什么苹果还没有解决这个问题。修复它是一个两步过程:
- 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.
- 编辑您当前的方案并在“运行”选项卡下将调试器从 LLDB 更改为 GDB。
- 转到https://developer.apple.com/bugreporter/并报告错误,以便 Apple 解决它。