问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/31463935/nsfetchedresultscontroller-not-refreshing-when-updating-relationship-from-chil