Using gdb to print out Objective-C objects

Sometimes the object that you want to debug is more complicated then an int or string.

In those situations, you will need to ‘pass a message’ to the object:

po (int)[textField superview]

Even then, there are occasions where you will have to use a selector:

print (int)[receivedData performSelector:@selector(count) ]

And finally, use a selector with an object as an argument:

print (int)[receivedData performSelector:@selector(count) withObject:myObject ]

Reference: stackoverflow wiki

Comments are closed.