Xcode 4 debugger lies. (See comment above by Herrman Klecker)
Ignore the grey color text "(null)".
Look at this question, Xcode debugging: View value of NSNumber?, for tips on displaying actual values.
One way…
Set breakpoint after your code, click into the debugger Console View, and use the Print Object command by typing po y
. Press Return/Enter to execute the expression and see resulting value in the console. The commands p
and po
work in both the older gdb
and newer lldb
debugger technologies. See Debugging tips for Objective-C programming for examples.
Another way…
Open the Debugger view and in the Summary column enter something like:
{(int)[$VAR intValue]}