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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With