I'm trying to use the console debugger (LLDB) to print out some variables but quite often the output doesn't display any of the variable's properties:
p _myObject
or po _myObject
(neither work)
yields
(myApp.SomeEntity) $R2 = 0x00007fa4aad2fda0 {
myApp.SomeParentEntity = {
CoreData.NSManagedObject = {
ObjectiveC.NSObject = {}
}
}
}
ditto for other NSObjects
, is there a special way you have to print out NSObjects
in Swift?
In Swift, you can print a variable or a constant to the screen using the print() function.
By using printf with the appropriate parameters, we can display things this way. This is the only way I have found to work on online Objective-C sandbox environments. Show activity on this post. In Swift with Xcode you can use either print() or NSLog() .
I had the same problem with XCode 6 and Swift project.
I finally found the explanation : On the bottom left of the Debugger console your have a Menu List with 3 options :
To see po < variableName >
you have to select All output or Debugger Output.
Correct way:
po _myObject
po - print object. You can read this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With