1

If I make changes to a managed object on a child context and then save that context, if the changes are only to the relationships of that object, it does not refresh. Is there a solution to this besides also updating a property of said object?

Ben Guild
  • 4,881
  • 7
  • 34
  • 60
  • amazingly **core data does not do this** - there are many QA about it, example https://stackoverflow.com/questions/4010334/reflect-changes-to-objects-in-a-relationship-in-parent-object-with-nsfetchedresu?rq=1 – Fattie Feb 17 '20 at 23:31

1 Answers1

0

Have you tried calling -processPendingChanges on the context after you have merged the changes? Apple's documentation states

Changes are not reflected until after the controller’s managed object context has received a processPendingChanges message.

Apparently this gets called at the end of the event loop for MacOS applications, but it's not clear of or when it's called on iOS.

Also, ensure you've implemented at least one of the change-tracking methods in your NSFetchedResultsControllerDelegate, otherwise you won't be tracking any changes to the context. Again from Apple:

A delegate must implement at least one of the change tracking delegate methods in order for change tracking to be enabled. Providing an empty implementation of controllerDidChangeContent: is sufficient.

quantumkid
  • 438
  • 4
  • 7
  • Which queue is the context on? `performBlockAndWait:` performs the block on the context's queue, which might not be the main one. Are you sure you are waiting until the block completes? Also, how are you getting the changes to the context? Are you calling `performFetch:` on the FRC or using the delegate callback methods? – quantumkid Jul 18 '15 at 07:53
  • 1
    this issue is **not related**. Core Data simply ***does not propagate changes*** from relationships - believe or not – Fattie Feb 17 '20 at 23:34