Apple says: > It is not safe to remove, replace, or add to a mutable collection’s elements > while enumerating through it. If you need to modify a collection during > enumeration, you can either make a copy of the collection and enumerate using > the copy or collect the information you require during the enumeration and > apply the changes afterwards. The second pattern is illustrated in Listing 4.
So is this safe... NSMutableDictionary* collection; // keys are myID, values are MyObject for (MyObject* object in [[self collection] allValues]) { [collection removeObjectForKey:[object myID]]; } It would seem that this is really enumberating the allValues array which assuming it is only called once, represents the objects that exist at the beginning of the for loop and removing them fro the collection dictionary is safe. Right? Trygve _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com