I am presenting table view contents using NSFetchedResultsController
which has a predicate:
[NSPredicate predicateWithFormat:@"visible == %@", [NSNumber numberWithBool:YES]]
On background thread using separate NSManagedObjectContext
I update few of the entities and change theirs visible
value from NO
to YES
. Save, merge changes in main thread's NSManagedObjectContext
. But NSFetchedResultsController
's fetchedObjects
doesn't change. Also controller doesn't call -controller:didChangeObject:...
on delegate. If entities are updated on main thread in identical manner (my test app calls the same method), everything works as expected.
Also Notification's NSUpdatedObjectsKey
contains those objects.
Currently the only solutions I've found is to call for each of NSUpdatedObjectsKey
entities:
NSManagedObjectContext *context = ... // main thread context
[context existingObjectWithID:[object objectID] error:nil]
This issue is only with updated objects which previously didn't match the predicate.
Am I missing something obvious?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…