In XCode, I insert a breakpoint at some line..
Say that line is:
abc = [books valueForKey:@"OfficialName"];
x = [appDelegate.books count];
My question is in the debugger, if I hover over say abc, it will display the value
But if I want to see the runtime value of an expression say "appDelegate.books count"
it does not show the value. How can I get the value of this expression 开发者_Go百科like a normal var ?
You can determine variable value using debugger console:
print (int) [arr count]
or use command po
to print object's description
po objectName
This is somewhat unorthodox, but in order to find what you get in that for loop (see hmthur's comment in my other answer):
for (x=0;x<[arr count];x++)
Firstly, spread the loop over three seperate lines, so that you can debug step them one bit at a time:
for (x = 0;
x < [arr count];
x++)
Now put a breakpoint at the start of the for loop.
Step down so that x < [arr count] has been executed, but not the x++
Now in the watch window of the debugger, open up the registers group.
The result returned by [arr count] will be present in the $eax register.
This is most unorthodox, don't rely on it for developing life-critical software! Stick with my original answer in the interests of sanity.
It's not a variable, it's a message. But the answer will be stored in x, so hover over that instead.
精彩评论