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.
Why?
func textFieldShouldReturn(textField:UITextField) -> Bool {
let myText = "Hello World"
let theText = textField.text! as String
return true
}
Here's the debugger result:
(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.
Here's the screenshot:
As confirmed by others above, this is pretty much strictly a bug in Swift / LLDB. It was mostly working as of 6.1.1, broken for or before 6.3 Beta 1, and fixed again in 6.3 Beta 2.
I am just using a command line app as a test and can't test with UIKit, but I have seen similar problems outside of UIKit - and by problems, I mean that I got results like the OP, but now it is working:
p and po yield slightly different results, and depend on whether or not Printable is implemented:
Per the thread here: https://devforums.apple.com/message/1111705#1111705, you can also use the
image lookup -t <SymbolName>
commandIt is worth emphasizing though, that you should double check that the Swift compiler is set to:
If you implement Printable on a swift class, then you will get the results of the description property.
There were previous Xcode bugs where Xcode would crash when trying to step through optimized code.
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.
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.