How do I find the value of an attribute in the debugger?

I have a button and want to know its enabled state by walking through the code. This doesn't work in the debugger:

po self.myButton.enabled

      

It prints:

There is no member named enabled.

      

Is there any other way to print its state?

+2


a source to share


1 answer


gdb doesn't know the dot syntax of properties, but it will evaluate method calls. - [UIButton enabled] returns BOOL, which is a scalar type, not an object, so you must use p

with a type like:

p (BOOL)[[self myButton] enabled]

      



If the property you want to check is an object, you can use po

without applying a type, for example:

po [[self myButton] font]

      

+3


a source







All Articles