Coredata NSFetchResultControllerDelegate didChange called but anObject changedValues() is empty

Hello all,

I experience two differents NSFetchResultController experiences varying context configuration.

First scenario: stack is nested, i.e. mainContext is parent of a background context and main context the coordinator for parent. Once private context is saved I get a didChange called on my NSFetchResultController delegate with "update" change key and a non empty changedValues() from the object that has been actually changed from my background context. So far so good I can detect what has been changed and decide if I need to reload my ui.

Failing second scenario: stack context is sibling, both main and background context have coordinator for parent hence no relation between contexts. Once my background context save I listen to a save notification to perform (on the main thread) a merge of the background context to the main context.

In this configuration, my NSFetchResultController delegate is called with a didChange "update" but the changedValues() are empty in this case.

Could someone knows why in that case I don't get the detail of what has been changed from the background context whereas if I subscribe to the merge notification manually (i.e. NotificationCenter.default.addObserver(forName: .NSManagedObjectContextDidMergeChangesObjectIDs, object: nil, queue: .main)) in the same class holding my FRC I get the detail of what has been change from the merge via the notification.userInfo?[NSUpdatedObjectsKey] dic and changedValues() is not empty ?

Many thanks in advance for any answers. Best regards

Cédric

Coredata NSFetchResultControllerDelegate didChange called but anObject changedValues() is empty
 
 
Q