How do you use the debugger in XCode to see if a variable is nil?
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.
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.
This is really angering me, too. Hovering over a variable doesn't do anything. Adding it to the expressions window always shows "out of scope", as does trying to use "po" in the gdb window. What is going on? I'm literally stopped on the same line as the variable I want to assign something to. Do you really have to be at a breakpoint? What if I have stepped a bit after a breakpoint?
This is driving me nuts. Please help.
Jeff