I want to remove object from array when the name is same. How to do this? Thanks in advance. Here is my code
NSString *name1;
NSString *name2;
NSArray *copyArray = [uniqueArraySort copy];
for (NSMutableDictionary *dict1 in copyArray) {
for (NSDictionary *dict2 in uniqueArraySort) {
name1 = [dict1 valueForKey:@"name"];
name2 = [dict2 valueForKey:@"name"];
if ([name1 isEqualToString:name2]) {
NSLog(@"%@",uniqueArraySort);
[uniqueArraySort removeObject:dict2];
NSLog(@"%@",uniqueArraySort);
}
}
}
And when I compile I get this error <__NSArrayM: 0x7fea39804f40> was mutated while being enumerated.'