How to surveil variables in XCode4.2's debugger

101 views Asked by At

I have a few int16 attributes of my core data entities, and I want to surveil them during the debugging

but I met some troubles.

First, I want to surveil attributes named "order" and "total", both of the type integer 16.

and here is my code for debugging.

NSArray *expenseTypes = [self.managedObjectContext executeFetchRequest:request error:&error];
NSLog(@"expenseTypes: %d",[expenseTypes count]);
i = 1;
for (ExpenseType *one in expenseTypes)
    NSLog(@"..%d : %@ : %d",i++,[one name],[[one order] intValue]);

and the values printed out are supposed to be some very common and small non-negative integers like 0,1,2,3,etc.

but in the debugger it turn out to be like this:

enter image description here

forget about this strange names(those who between two colons), but the integers turn out to be very ridiculous ,

some of the numbers are just want I want, but others seems random,

and here is my code to set these integer16 attributes:

NSUInteger all;
all = (NSUInteger)[self.superTypeEntity total];
[newManagedObject setValue:[NSNumber numberWithUnsignedInt:all]
                        forKey:@"order"];

I think the problems is not about these code.

integer 16 attributes are NSNumber's instaces, so I use ("%d",[xx intValue])

is there something wrong with it?

I always have a difficult time surveilling some variables in XCode, especially some of core data, everytime I have to search for them in the place below and all the variables are displayed in formats of pointers, I can hardly check out whether a string, or a integer is what I want or not.

enter image description here

Sorry for my silly questions, since I am a green hand of IOS development,

But I am hoping someone come to help me!

Thanks more than a lot!

1

There are 1 answers

0
Wang Liang On BEST ANSWER

Hey I found the anwser by myself, in the code that set the value I miss an important method,

and it should be like this:

all = (NSUInteger)[[self.superTypeEntity total] **intValue**];

in this way the values printed out would be ok.