Reputation: 87
I try to access some values in a NSMutableArray I created, but I only get some numbers (address?) if I try to access them.
I was able to initialize an array and can add and change objects with
[myNSMutableArray addObject:[NSNumber numberWithInt:10]]
and
[myNSMutableArray replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:47]
I also can print the value at index [0] with
NSLog(@"%@", [myNSMutableArray objectAtIndex:0]);
and I get 47
as expected.
But how can I access the integer value of the object in the array so I can save it tomyIntValue
?
Upvotes: 0
Views: 647
Reputation: 3737
int myIntValue = [[myNSMutableArray objectAtIndex:0] intValue];
Just have a look at the NSNumber class reference
Upvotes: 3