I have an NSMutableArray and I am trying to use the insertObjectAtIndex method, but it does not work. It seems to think I am trying to do something mutable with an immutable array..... but I am using an NS ..... MUTABLE.... Array. So what an earth could be wrong??
Here is my code:
if ([dataArray count] == 0) {
// Initialise the audio arrays.
dataArray = [[NSMutableArray alloc] init];
// Now add the data to the array.
[dataArray addObject:@"test 1"];
}
else {
[dataArray insertObject:@"test 2" atIndex:0];
}
NSLog(@"d in: %@", dataArray);
The dataArray is defined in the header file like so:
NSMutableArray *dataArray;
Thanks for your time, Dan.