I’m trying to insert objects (NSNumbers) into an NSMutable array, but when I check it, the objectAtElement always returns 0.
NSNumber *indexNum = [NSNumber numberWithInt:indexInt];
[last100 insertObject:indexNum atIndex:prevCount];
NSLog(@"Entry #%d : %d", prevCount, (int)[last100 objectAtIndex:prevCount]);
prevCount++;
indexInt is coming in through the method, I already checked it and its valid. indexNum has also been checked and matches indexInt. The problem is NSLog(@"Entry #%d : %d", prevCount, (int)[last100 objectAtIndex:prevCount]); which always returns
2012-01-08 14:08:11.551 ThoughtSpreader[20746:fb03] Entry #9 : 0 The entry number will change, but the 0 is always there.
Oh, I also checked [last100 count] after every time I insert something new into it, and it always returns 0, so I believe its a problem with how I’m inserting something into the NSMutable array
If your count always returns 0 the likelihood is you haven’t actually instantiated your
NSMutableArray.Updated
%dto%luthanks to @markhunte – it’s hard to remember the finer details without testing it