Coredata之 executeFetchRequest 和 performFetch

转载备份,来源:https://blog.csdn.net/binglan520/article/details/53482794

两者是不同的处理方式。

executeFetchRequest:

  • Message sent to MOC     消息发送给MOC即context
  • Return an array of managed objects   返回一系列的managed objects
  • Goal: fetch objects from persistent store to MOC  从持久化存储中获取对象到context中去
  • With table view: has nothing to do with table view 调用后不会自动和table view相关处理相联系

performFetch:

  • Message sent to FRC 消息发送给FRC即coordinator
  • After calling it, use fetchedObjects to return an array of managed objects 使用fetchedObjects来返回managed 对象数组
  • With table view: FRC is specifically for keeping managed objects and table view rows in sync, and use performFetch to initialize that process.调用后会自动出发tableview相关的处理来展示

你可能感兴趣的:(IOS)