If you have a Core Data data model with one Entity, say “AircraftCategory” that has a “to-many” Relationship to another, say “AircraftClass”, you can access the AircraftClass objects for an AircraftCategory using an NSMutableSet. But if you Fetch an NSMutableArray of AircraftCategory, and are doing a “fast enumeration” through the AircraftCategory objects, and you happen to remove one of the AircraftClass items from the current AircraftCategory object using one of the generated accessors, the fast enumeration will see that as a modification of the NSMutableArray of AircraftCategory and throw an exception. This is in contrast to Java where you would only get an exception if you were to add or remove things from the actual Collection that you were iterating, and not from calling setter methods on the objects in the Collection.
So instead of removing the AircraftClass from the AircraftCategory, I discovered that what I have to do is remove it from Core Data directly, using
I haven’t tried it yet, but I wonder if this wouldn’t happen if I assigned the fetch results to an NSArray instead of an NSMutableArray?