I have a block of code which is similar to the following:
for (NSDictionary *tmp in aCollection) {
if ([[bar valueForKey:@"id"] isEqualToString:[tmp valueForKey:@"id"]])
{
break;
}
else
{
[aCollection addObject:bar];
}
}
Is this technically an exception in Objective-C 2.0? It appears you cannot mutate a collection with fast enumeration. This is the result of an error:
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <NSCFArray: 0x396000> was mutated while being enumerated.'
What's the best way to solve this?