The po command is a bit useless, at least unless there are some runes one has to cast to make it useful, in which case what are they?
For example, take this code:
MyClass *myClass = ...
NSLog(@"stuff: %@", myClass.stuff);
If running this code in Xcode and trying to debug then po behaves as:
(gdb) po myClass
<MyClass: 0xee34567>
(gdb) po myClass.stuff
There is no member named stuff
Why does it do this. There is a property called stuff, and NSLog has no problem seeing it. So how to inspect member variables in Xcode, I know this question has been asked on here many times before, but after reading them I still can’t find a decent way of doing so.
This answer is for Objective C, specifically.
poonly works with ObjC objects so I’m assuming that’s what you’re asking about here.Have you tried:
This works fine for me – assuming
stuffis a property.po myObjis equivalent to calling[myObj description]. If you want to list all the ivars of a particular object usingpoyou’d have to implement a suitabledescriptionmethod for its class. I am not aware of any automatic mechanism for listing the ivars of a class. There may well be, at least if you are dealing with properties.This is worth a read too: gdb for Objective C.