Reputation: 107
I am reading a bunch of NSNumber values from a plist, and the first line in the code I'm showing you has the value of 2 for stoneOne[@"Column"]. When I set a breakpoint for 'c' in the second line, and examine [c intValue], c is correctly int 2. However, when I analyze the value of NSInteger column, the value is 528839664. Any reason for this? Should I just not get the intValue of c? Is it necessary? (I thought for converting NSNumber values to readable NSInteger values you had to call that method).
NSNumber* c = stoneOne[@"Column"];
NSInteger column = [c intValue];
Upvotes: 0
Views: 382
Reputation: 3816
Ok, Two things.
As Eiko Pointed out, you need to go to the next line, to ensure the assignment like NSInteger column = [c intValue];
is executed. Just go one step ahead, or put the breakpoint in the line below it.
Secondly, use NSInteger column = [c integerValue];
to optimally convert to NSInteger.
Upvotes: 1