I'm trying to remove a managed object context, but instead of removing the object itself it sets all instant variables to null. Am I doing 开发者_运维知识库anything wrong while deleting an instant of NSManagedObjectContext?
@implementation MyManagedObject
- (BOOL)submitToServer
{
if (/*submitted successfully*/)
{
return YES;
}
else
{
[self.managedObjectContext deleteObject:self];
return NO;
}
}
@end
You must call [self.managedObjectContext save:nil]
after deleteObject
for the delete to be committed to the persistent store. Read more about deleting a managed object.
精彩评论