debugging - Xcode 的 'po' 无法识别我想要研究的变量。为什么?

标签 debugging swift xcode6

环境: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)

注意:调试输出设置为“所有输出”。

截图如下:

enter image description here

最佳答案

这个也是我遇到的问题,我认为是调试器的bug。如果您不使用任何用“let”声明的变量,po 命令将起作用。这当然不是你想要的,所以我就这个问题向 Apple 提交了一个错误。

我认为你应该希望它在下一个测试版中得到修复(请也提交错误,因为提交的错误数量会影响 Apple 修复它们的优先级)。同时,使用 Amitays 解决方法。

关于debugging - Xcode 的 'po' 无法识别我想要研究的变量。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24977282/

相关文章:

Swift:检查编译器是否支持条件一致性

ios - Swift 良好编码实践 : If statement with optional type Bool

ios 7.0 模拟器不会在 xcode 6.0.1 中下载

c++ - 在 Release模式下崩溃但在 Debug模式下不崩溃的 ActiveX 控件

c#:调试时公开,否则私有(private)

debugging - 有没有办法像在 QTP 9.2 中使用 pdm.dll 那样改进 QTP 的调试引擎?

iOS:Xcode 6 中的 IBOutlet 为零

debugging - IDEA卡在远程调试端口

ios - 引用超出范围的 UICollectionViewCell

objective-c - 将 objective-c 转换为 swift : @() syntax