I will do import from XML to the main data. I have about 50 thousand objects to be added. My question is how often can I call [managedObjectContext save: & error]. For each added new object or all objects x or only at the end of the import 50,000?
Currently, I call it for each object and try to do it in just 10 thousand, and the import speed increases sharply, but after the first 30 thousand it fails:
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <NSCFSet: 0x13e760> was mutated while being enumerated.'
Before I spend too much time trying to diagnose what is happening, I decided to check whether it was normal to cause savings on each entity?
Is the number of entities before the savings call limited by the amount of memory used by these entities?
source share