I've setup 2 NSManagedContext in a child-parent context in Core Data.
_mainContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
[_mainContext setParentContext:_parentContext];
[_mainContext setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy];
_importContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
[_importContext setParentContext:_mainContext];
[_importContext setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy];
What happens if I execute the following in order ("fetch" meaning NSFetchRequest):
- Fetch Managed object A in mainContext.
- Fetch Managed object A in importContext.
- Update object A in mainContext.
- Fetch Managed object A in importContext.
importContext (child) -> mainContext (parent) -> Persist Store Coordinator
My question is, at step 4, will the object that was fetched in the importContext have the updated changes I made at step 3 in the mainContext? Reading articles on the web seem to indicate that changes made in a parentContext are not propagated down to child context if the child context has already fetched the data (because contexts are cached?)