Permalink
Browse files

Merge pull request #202 from jwie/fix_unit_test

[NSManagedObjectContext MR_saveInBackgroundErrorHandler:completion:]
  • Loading branch information...
2 parents 8bb0d0d + eabb147 commit e117ead8bf67b7cd9f2ebb64284df2e4cc4b2352 @casademora casademora committed Jul 8, 2012
@@ -98,15 +98,15 @@ - (void) MR_saveInBackgroundErrorHandler:(void (^)(NSError *))errorCallback;
- (void) MR_saveInBackgroundErrorHandler:(void (^)(NSError *))errorCallback completion:(void (^)(void))completion;
{
- [self performBlock:^{
+ [self performBlockAndWait:^{
[self MR_saveWithErrorCallback:errorCallback];
if (self == [[self class] MR_defaultContext])
{
[[[self class] MR_rootSavingContext] MR_saveInBackgroundErrorHandler:errorCallback completion:completion];
}
- if (self == [[self class] MR_rootSavingContext])
+ if (completion && self == [[self class] MR_rootSavingContext])
{
dispatch_async(dispatch_get_main_queue(), completion);
}

0 comments on commit e117ead

Please sign in to comment.