Created
July 27, 2014 20:37
Revisions
-
Tim Ritchey created this gist
Jul 27, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ - (void)backgroundContextDidSaveNotification:(NSNotification*)notification { for (NSManagedObject *object in notification.userInfo[NSDeletedObjectsKey]) { NSLog(@"deleted: %@", object.entity.name); } // the background moc saved - merge changes NSManagedObjectContext *context = [self managedObjectContext]; void (^mergeChanges) (void) = ^ { [context mergeChangesFromContextDidSaveNotification:notification]; }; if ([NSThread isMainThread]) { mergeChanges(); } else { dispatch_sync(dispatch_get_main_queue(), mergeChanges); } }