mirror of
https://github.com/zhigang1992/MagicalRecord.git
synced 2026-04-29 20:46:37 +08:00
If saving a MOC when it's a NSConfinementConcurrencyType, don't use performBlock* on save
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#import "MagicalRecord.h"
|
||||
#import "MagicalRecord+iCloud.h"
|
||||
|
||||
static void const * kMagicalRecordNotifiesMainContextAssociatedValueKey = @"kMagicalRecordNotifiesMainContextOnSave";
|
||||
//static void const * kMagicalRecordNotifiesMainContextAssociatedValueKey = @"kMagicalRecordNotifiesMainContextOnSave";
|
||||
NSString * const kMagicalRecordDidMergeChangesFromiCloudNotification = @"kMagicalRecordDidMergeChangesFromiCloudNotification";
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
MRLog(@"→ Save Parents? %@", @(saveParentContexts));
|
||||
MRLog(@"→ Save Synchronously? %@", @(syncSave));
|
||||
|
||||
id saveBlock = ^{
|
||||
void (^saveBlock)(void) = ^{
|
||||
NSError *error = nil;
|
||||
BOOL saved = NO;
|
||||
|
||||
@@ -94,9 +94,16 @@
|
||||
}
|
||||
};
|
||||
|
||||
if (YES == syncSave) {
|
||||
if ([self concurrencyType] == NSConfinementConcurrencyType)
|
||||
{
|
||||
saveBlock();
|
||||
}
|
||||
else if (YES == syncSave)
|
||||
{
|
||||
[self performBlockAndWait:saveBlock];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
[self performBlock:saveBlock];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user