node ninja
node ninja

Reputation: 32986

How to check a variable's value using a debugger in XCode

How do you use the debugger in XCode to see if a variable is nil?

Upvotes: 2

Views: 1771

Answers (2)

Greg Sexton
Greg Sexton

Reputation: 9279

If the pointer's address is 0x000000 it's nil.

Hovering over the variable in the debugger should show a tooltip, this will show you the type of the variable, the name and a value. If it is a pointer to an object the value will be the address that it points to. This will be 0x0 if it is nil.

Upvotes: 2

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36617

Just open up the GDB Console and type po myvar or insert a breakpoint after you set your variable and move your cursor over the target variable.

Upvotes: 2

Related Questions