Here is the code snippet of my core data operation . It works fine most of the time. But now when I added core data debugging argument to see if all the core data calls are fine with respect to multithreading Core Data Concurrency Debugging , I see a crash on the line [contexts reset]; .
- (void)readAllModelObjects { NSFetchRequest * fr = [NSFetchRequest ....] NSManagedObjectContext * context = [selg getChildContext]; [context performBlockAndWait:^{ NSArray * resultArray = [context executeFetchRequest:fr error: nil ]; NSArray * nonCoreDataModelObjectsArray = [self parseCoreDataObjectsToModel: resultArray]; _memberResultArray = nonCoreDataModelObjectsArray ; }]; [context reset]; // This is the line it crashes . } - (NSManagedObjectContet *)getChildContext { NSManagedObjectContext * privateContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType]; privateContext.parentContext = [self mainQueueManagedObjectContext]; return privateContext ; } - (NSArray * )parseCoreDataObjectsToModel:(NSArray *)cdObjectsArray { // creates and initializes the model objects array (non managed object class objects ) from core data objects // return this array } There is only one main queue context attached to persistent store coordinator . This one is used as parent for each child context that is created for a core data operation .
(void)readAllModelObjects is called from a background thread as expected .
I got below error from core data
CoreData`+[NSManagedObjectContext _ _Multithreading_Violation_AllThatIsLeftToUsIsHonor__]: Any hints / suggestions will definitely help me in figuring out the crash , please help .