If I have a mutable array “codes” in an NSMutableDictionary “categorize”
NSMutableArray *myMutableArray=(NSMutableArray*)[categorize objectForKey:@"codes"];
and I add objects from another non-mutable array “templateCodes” in an NSDictionary “templateCategorize”
[codes addObjectsFromArray:(NSArray*)[templateCategorize objectForKey:@"templateCodes"]];
does the codes array become “non-mutable” because I copied elements from a non-mutable array (templateCodes)?
This code works the first time objects are copied, but the second time this code is executed I get an error that the “addObjectsFromArray” selector is not valid indicating the array is non-mutable.
I don’t think it should make your mutable array immutable — a mutable array can contain immutable objects, so adding objects from another array shouldn’t make it immutable. This code works fine:
Something else must be going on in your code that I’m not seeing.