Does NSFetchedResultsController Observe All Changes to Persistent Store?

自作多情 提交于 2019-12-01 04:12:17

I thought NSFetchedResultController watches all changes in persistent store, is it too big hope?

The FRC only automatically observes the objects returned by its fetch. This is normally not a problem as changes to objects monitored by an FRC should arise from either the tableview UI or a background context. In the former, the FRC is alerted to the change and in the latter, merging the foreground and background context will trigger the FRC to update.

It sounds like you've got code changing values but you're not notifying the FRC that you've made any changes. (If you got a tableview displaying all objects whose isMyTest == TRUE then obviously you can't access objects from the UI whose isMyTest == FALSE.) In that case, you need to register the tableview controller for:

NSManagedObjectContextObjectsDidChangeNotification

… notifications from the context so that you can tell the FRC to update for changes made outside its observation.

I'm sorry to my mistake, I tested with new test project.

CoreData DOES full-tracking of whole persistent store.

This means, if new object that is suitable to predicate of NSFetchedResultsController, delegate will notify it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!