Apples documentation on NSManagedObject
’s managedObjectContext
method says:
This method may return nil if the receiver has been deleted from its context.
Does anyone know under what circumstances this method will return nil for a receiver that is deleted and under what circumstances it will still return the managed object context?
Background:
I override -didSave
in order to move files that are referenced by a deleted managed object to the trash. After that, i have to clear the undo manager, because the deletion of this managed object can no longer be undone, as the files cannot be put back from the trash. So i will call:
[[[self managedObjectContext] undoManager] removeAllActions];
which will only work if -managedObjectContext
does not return nil at this point.