2

I have an app with a simple CoreData model that is 3 entities:

B <---> A <<----> C

A is the main object and it has relationships to (aggregates) 2 other entities (B and C).

The UI shows some bits of data from all 3 in the UITableView and the detail view (it's a master/detail app). My problem is that if the user edits the currently viewed item and modifies properties of B or C the NSFetchedResultsController that is keyed on entities of type A does not get called via the NSFetchedResultsControllerDelegate.

Logically, changes in B/C objects is a change to an A in terms of the aggregate being displayed. Is there a way to configure the fetch or the controller so that it will update itself if any of these entity types change?

SlashDevSlashGnoll
  • 2,141
  • 1
  • 12
  • 15
  • I haven't tried it before but try setting the dependencies using 'NSFecthRequest relationshipKeyPathsForPrefetching' for the request passed to the FRC. – Wain Apr 27 '13 at 13:17
  • That had occurred to me and it doesn't quite do the trick, that will only accomplish prefetching. Thanks for the idea though! – SlashDevSlashGnoll Apr 27 '13 at 13:21
  • 1
    it is very similar to [this](http://stackoverflow.com/questions/16242304/nsfetchedresultscontroller-multiple-entities-for-uitableview/16243243#16243243) – Dan Shelly Apr 27 '13 at 13:34

1 Answers1

0

There are various solutions.

  1. Hack your entities like in the link indicated by Dan Shelley above.
  2. Make your view controllers listen to each other via delegate protocols or notifications and react accordingly. This is the standard way if you do not have Core Data and NSFetchedResultsController involved.
Community
  • 1
  • 1
Mundi
  • 79,884
  • 17
  • 117
  • 140