环境:Xcode 6 Beta 4
我试图仅使用查看文本值
调试器。但是,调试器无法识别静态变量(通过“让”)。对于 vars 也是如此。
为什么?
func textFieldShouldReturn(textField:UITextField) -> Bool {
let myText = "Hello World"
let theText = textField.text! as String
return true
}
这是调试器的结果:
(lldb) po textField error: :1:1: error: use of unresolved identifier 'textField' textField ^ :11:5: error: use of unresolved identifier '$__lldb_injected_self' $__lldb_injected_self.$__lldb_wrapped_expr_29(
^ (lldb) po myText error: :1:1: error: use of unresolved identifier 'myText' myText ^ :11:5: error: use of unresolved identifier '$__lldb_injected_self' $__lldb_injected_self.$__lldb_wrapped_expr_30(
^ (lldb) po theText error: :1:1: error: use of unresolved identifier 'theText' theText ^ :11:5: error: use of unresolved identifier '$__lldb_injected_self' $__lldb_injected_self.$__lldb_wrapped_expr_31(
^ (lldb)
注意:调试输出设置为“所有输出”。
截图如下:
最佳答案
这个也是我遇到的问题,我认为是调试器的bug。如果您不使用任何用“let”声明的变量,po 命令将起作用。这当然不是你想要的,所以我就这个问题向 Apple 提交了一个错误。
我认为你应该希望它在下一个测试版中得到修复(请也提交错误,因为提交的错误数量会影响 Apple 修复它们的优先级)。同时,使用 Amitays 解决方法。
关于debugging - Xcode 的 'po' 无法识别我想要研究的变量。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24977282/