Skip to content

Commit

Permalink
Merge pull request #12 from lquigley/master
Browse files Browse the repository at this point in the history
Issue where changes were ignored in fetchedresults
  • Loading branch information
Sean Wolter committed Aug 21, 2014
2 parents a4ca3c6 + a69a240 commit dd04895
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions VOKCoreDataManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,15 @@ - (void)saveTempContext:(NSManagedObjectContext *)tempContext

- (void)tempContextSaved:(NSNotification *)notification
{
// Solved issue with NSFetchedResultsController ignoring changes
// merged from different managed object contexts by touching
// willAccessValueForKey: on the updated objects.
//http://stackoverflow.com/questions/3923826/nsfetchedresultscontroller-with-predicate-ignores-changes-merged-from-different

for (NSManagedObject *object in [[notification userInfo] objectForKey:NSUpdatedObjectsKey]) {
[[[self managedObjectContext] objectWithID:[object objectID]] willAccessValueForKey:nil];
}

if ([NSOperationQueue mainQueue] == [NSOperationQueue currentQueue]) {
[[self managedObjectContext] mergeChangesFromContextDidSaveNotification:notification];
} else {
Expand Down

0 comments on commit dd04895

Please sign in to comment.