My application has NSOperation
subclasses that fetch and operate on managed objects. My application also periodically purges rows from the database, which can result in the following race condition:
'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault'
Ideally, the objects that are fetched by the NSOperation can be operated on even if one is deleted in the main context. The best way I can think to achieve this is either to:
[request setReturnsObjectsAsFaults:NO]
to ensure that Core Data won't try to fulfill a fault for an object that no longer exists in the main context. The problem here is I may need to access the object's relationships, which (to my understanding) will still be faulted.Am I missing something obvious? It doesn't seem like what I'm trying to accomplish is too out of the ordinary. Thanks for your help.
I ended up mitigating this by perform both fetches and deletes on the same queue.