It seems that when I use mutableCopy whilst the first dimension of arrays stays mutable, but all the arrays within the array have become immutable.
My current code seems to have no effect, and attempting to edit the array results in an NSInvalidArgumentException.
The code is supposed to make a deep copy of the input (a 3d array) then make sure that it is mutable.
-(NSMutableArray*) copyMutable :(NSMutableArray*) input{
NSMutableArray* copyInput = [[input mutableCopy] autorelease];
NSMutableArray* copy =
[[[NSMutableArray alloc] initWithArray:copyInput copyItems:YES] autorelease];
NSMutableArray* copylayer;
NSMutableArray* copylayertwo;
arraycount=0;
arraycountTwo=0;
arraycountThree=0;
NSMutableArray* inputCopy = [[[NSMutableArray alloc] init]autorelease];
for (int a=0; a<[inputCopy count]; a++){
copylayer=[[[copy objectAtIndex:arraycount] mutableCopy]autorelease];
[copy replaceObjectAtIndex:arraycount withObject:copylayer];
for (int b=0; b<[inputCopy count]; b++){
copylayertwo = [[copy objectAtIndex:arraycount] objectAtIndex:arraycountTwo];
[[copy objectAtIndex:arraycount] replaceObjectAtIndex:arraycountTwo withObject:copylayertwo];
arraycountTwo++;
}
arraycount++;
}
return copy;
}