The NSManagedObjects method documentation managedObjectContextsays:
This method can return zero if the recipient has been removed from its context.
Does anyone know under what circumstances this method will return nil for a recipient that has been deleted, and under what circumstances will it still return the context of the managed entity?
Background:
I redefine -didSaveto move the files referenced by the remote managed entity to the trash. After that, I need to clear the undo manager because deleting this managed entity can no longer be undone since files cannot be returned from the trash. Therefore, I will call:
[[[self managedObjectContext] undoManager] removeAllActions];
which will work only if it -managedObjectContextdoes not return nil at this point.
source
share