0

I've got the following predicates set up:

fetchRequest.predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [
    NSPredicate(format: "start >= %@", NSDate.init(timeIntervalSinceNow: 0).dateByRemovingTime()),
    NSPredicate(format: "product.filter.enabled == %@", true)
])

The entity for the fetch request is an Activity, which then contains a product. Each product then has a filter, which is either enabled or disabled.

Should it be reloaded when the boolean enabled is changed?

If not: how can I make it trigger? With willChangeValueForKey and didChangeValueForKey when changing enabled?

netdigger
  • 3,659
  • 3
  • 26
  • 49
  • did you search for duplicates? there are many – Wain Jul 14 '16 at 14:56
  • [this](http://stackoverflow.com/q/7533849/2446155), [this](http://stackoverflow.com/q/4010334/2446155), and [this](http://stackoverflow.com/a/12379824/2446155) – Andrew Jul 14 '16 at 15:01

1 Answers1

0

NSFetchedResultController is a KVO controller, it can only watch witch datas has been fetched in the controller or be inserted after the controller has been fetched. If you update the data witch has not in the controller or update the data's relationship data, the controller will not call the delegate or KVO observe. There is tow way to save the problem: 1. You can add a BOOL attribute for example "hasChanged" in the entity, if the relationship data has been changed, then change "hasChanged". 2. You can add a KVO on the relationship data

Hao
  • 201
  • 1
  • 3