May a NSManagedObjectContext re-fault objects automatically?
I am trying to create an application which allows background threads to update core data objects while the user might be reading the same data.
My approach to this would be to use multiple NSManagedObjectContexts and then before a background thread does a -save:
operation, I fetch the object the user is currently working on and fire the fault for all its properties and relationships recursively. This way I have all objects the user could act with in my NSManagedObjectContext without seeing the already updated values.
But this can only work if the NSManagedObjectContext cannot decide himself that e.g. memory usage is too high, and starts开发者_开发技巧 faulting objects which I do not explicitly reference (other than through the NSManagedObject relationship).
So the question is, can the NSManagedObjectContext decide that an object needs to be re-faulted, without intervention from my side?
Thanks for your effort, Markus
I believe there is nothing in the documentation for NSManagedObjectConext
or NSPersistentStoreCoordinator
that would prohibit the context converting an instance back into a fault if there are no unsaved updates to that instance.
精彩评论