mirror of
https://github.com/zhigang1992/MagicalRecord.git
synced 2026-01-12 17:32:18 +08:00
No changes to save is still a successful save
Let root context save in background if requested
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user