Xcode的“po”未能识别我想学习的变量。好吗 [英] Xcode's 'po' fails to identify the variable I wish to study. Wny?
问题描述
环境:Xcode 6 Beta 4
我试图用调试器
来查看一个文本值。但是,调试器无法识别静态变量(通过'Let')。这对于vars也是如此。
Environment: Xcode 6 Beta 4
I'm attempting to merely look into a text value using
the debugger. However the debugger fails to identify the static variable (via 'Let'). This is also true for vars.
为什么?
func textFieldShouldReturn(textField:UITextField) -> Bool {
let myText = "Hello World"
let theText = textField.text! as String
return true
}
这是调试器的结果:
(lldb)po textField错误::1:1:错误:使用未解决的
标识符'textField'textField ^:11:5 :错误:使用
未解析的标识符$ __ lldb_injected_self'
$ __ lldb_injected_self $ __ lldb_wrapped_expr_29(
^(lldb)po myText错误::1:1:错误:使用未解决标识符'myText'myText ^:11:5:错误:使用未解决的
标识符'$ __ lldb_injected_self'
$ __ lldb_injected_self $ __ lldb_wrapped_expr_30(
^(lldb)po theText错误: :1:1:错误:使用未解析的标识符'TheText'theText ^:11:5:错误:使用未解决的
标识符'$ __ lldb_injected_self'
$ __ lldb_injected_self $ __ lldb_wrapped_expr_31(
^(lldb)
(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)
注意:调试输出设置为全部输出。
Note: debug output is set to 'All Output.
这是截图:
推荐答案
这是一个我也遇到的问题,我认为这是调试器中的一个错误。如果您不使用用let声明的任何变量,则po命令将工作。这不是你想要的,所以我向苹果提出了一个这个问题的错误。
This is a problem I also encountered, and I think it is a bug in the debugger. If you do not use ANY variables declared with 'let', the po command will work. This is off course not what you want so I filed a bug with Apple for this issue.
我想你应该只是希望在下一个测试版中修复(文件也是一个错误,因为提交的错误的数量将影响到苹果在修复它们的优先级)。在此期间,请与Amitays解决方法。
I think you should just hope it is fixed in the next beta (file a bug too please, as number of filed bugs will influence Apple's priority in fixing them). In the meantime, go with Amitays workaround.
这篇关于Xcode的“po”未能识别我想学习的变量。好吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!