Hi,
In xcode you can use po object to see a textual representation of a given object. Is it possible to convert from this textual representation to a real objective c object?
Thanks
Hi,
In xcode you can use po object to see a textual representation of a given object. Is it possible to convert from this textual representation to a real objective c object?
Thanks
I suppose you could parse out the address, assign it to a pointer, and retrieve the object from memory that way, but that IS A HORRIBLY BAD IDEA AND YOU SHOULD NEVER DO THAT.
Real question: what are you trying to do?
No, the representation you see from po <instance>
is the result of -[<instance> debugDescription]
, which by default returns -[<instance> description]
, as described in http://developer.apple.com/mac/library/technotes/tn2004/tn2124.html.
Unless the instance you're dealing with just happens to provide a description which is a serialized form of itself, you're SOL. Most objects don't.
The real question, as Dave points out is, what are you trying to do? po
only works in the gdb console, so I assume this is a debugging issue. In that case, do you know that the gdb console supports sending messages to instances? So you can do:
po [<myInstance> methodReturningAnOtherObject]
or
po [<myInstance> valueForKeyPath:@"some.long.key.path"]
to follow the object graph from within the debugger console.