I need to store an int in an array, and I tried this way, converting the int to an NSNumber but integer ends up being 136894816… Can someone please help me with this?
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:5];
NSNumber *num = [NSNumber numberWithInt:10];
[array insertObject:num atIndex:0];
int integer = [array objectAtIndex:0];
An
NSNumberis not an int. What you are retrieving in your current code is a memory reference. Try this instead: