Created
March 28, 2017 13:41
-
-
Save drinkius/0b66842b3fb05cbab95c121b7361d9ea to your computer and use it in GitHub Desktop.
Save managed object context
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSManagedObjectContext *context = object.managedObjectContext; | |
while (context != nil) { | |
NSError *error = nil; | |
BOOL result = [context save:&error]; | |
NSAssert(result != NO, @"[ERROR]: Context was not saved"); | |
if (result) { | |
context = context.parentContext; | |
} else { | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment