I was wondering how to add a string to a mutable array without having to change the original array. So I'm thinking I have to make a copy of the array argument and then add the string to that.
-(NSMutableArray *)arrayByAddingString:(NSString *)string toArray:(NSMutableArray *)array
{
NSArray *newArray = [NSMutableArray arrayWithArray:array];
[newArray arrayByAddingObject:[string]];
return array;
}
I get the error Expected identifer, not sure what that means.
[newArray arrayByAddingObject: string];newArrayisNSArray. It should beNSMutableArray!!