No changes to save is still a successful save

Let root context save in background if requested
This commit is contained in:
Saul Mora
2013-02-21 18:35:43 -07:00
parent 1e8bb1ea17
commit aa787b5135

View File

@@ -45,21 +45,21 @@
if (completion)
{
dispatch_async(dispatch_get_main_queue(), ^{
completion(NO, nil);
completion(YES, nil);
});
}
return;
}
MRLog(@"→ Saving %@", [self MR_description]);
MRLog(@"→ Save Parents? %@", @(saveParentContexts));
MRLog(@"→ Save Synchronously? %@", @(syncSave));
void (^saveBlock)(void) = ^{
NSError *error = nil;
BOOL saved = NO;
MRLog(@"→ Saving %@", [self MR_description]);
MRLog(@"→ Save Parents? %@", @(saveParentContexts));
MRLog(@"→ Save Synchronously? %@", @(syncSave));
@try
{
saved = [self save:&error];
@@ -86,7 +86,7 @@
// If we're the default context, save to disk too (the user expects it to persist)
if (self == [[self class] MR_defaultContext])
{
[[[self class] MR_rootSavingContext] MR_saveWithOptions:MRSaveSynchronously completion:completion];
[[[self class] MR_rootSavingContext] MR_saveWithOptions:mask completion:completion];
}
// If we're saving parent contexts, do so
else if ((YES == saveParentContexts) && [self parentContext])