开发者

iPhone & Core Data - Removing NSManagedObject?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜