Use dispatch_sync instead of NSOperation for merging changes from background notification

This commit is contained in:
Blake Watters
2012-06-20 13:22:36 -04:00
parent e3f461624f
commit c4a329cc58

View File

@@ -408,9 +408,13 @@ static RKManagedObjectStore *defaultObjectStore = nil;
- (void)managedObjectContextDidSaveNotification:(NSNotification *)notification
{
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
if ([NSThread isMainThread]) {
[self.primaryManagedObjectContext mergeChangesFromContextDidSaveNotification:notification];
}];
} else {
dispatch_sync(dispatch_get_main_queue(), ^{
[self.primaryManagedObjectContext mergeChangesFromContextDidSaveNotification:notification];
});
}
}
#pragma mark -