I have an NSManagedObject
that has been deleted, and the context containing that managed object has been saved. I understand that isDeleted
returns YES
if Core Data will ask the persistent store to delete the object during the next save operation. However, since the save has already happened, isDeleted
returns NO
.
What is a good way to tell whether an NSManagedObject
has been deleted after its containing context has been saved?
(In case you're wondering why the object referring to the deleted managed object isn't already aware of the deletion, it's because the deletion and context save was initiated by a background thread which performed the deletion and save using performSelectorOnMainThread:withObject:waitUntilDone:
.)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…