NSFetchedResultsController tracks relationship changes

I have a model with two objects connected to each other. I want to display all EntityA objects in a TableView, where entityB.myIntAttribute is equal to the given value. This works when I create a FetchRequest for EntityA with the predicate @ "entityB.myIntAttribute == aValue".

My issue is tracking change. I set the NSFetchedResultsControllerDelegate delegate to the NSFetchedResultsController associated with the previous FetchRequest. This delegate works because it receives a delete notification if I install a new entity B that does not match the predicate for one of the results. But if I directly change the value of myIntAttribute on entityB so that the result of the predicate changes, my delegate is not notified of this change.

Does NSFetchedResultsController do tracking changes using a predicate that intersects relationships? How can a FetchedResultController recompile a predicate after changing a relation attribute?

+3
source share
1 answer

:

- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type

- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath

- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller

- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
-1

Source: https://habr.com/ru/post/1791070/