问题
When do I use a NSFetchedResultsController in comparsion to the objectsWithFetchRequest method in NSManagedObject? Are there typical scenarios?
回答1:
objectsWithFetchRequest:
(or executeFetchRequest:error:
) just executes a fetch request and returns the result set.
A NSFetchedResultsController
executes a fetch request and then monitors changes to the data store (or more precisely, changes to the managed object context). If objects are added/deleted/modified that cause the result set of the fetch request to change, it calls delegate functions to report the change.
A NSFetchedResultsController
is in most cases used to populate a table view with the result of a fetch request, and automatically update the table view if objects are inserted, deleted or changed.
来源:https://stackoverflow.com/questions/13335775/core-date-concept-nsfetchedresultscontroller-vs-nsmanagedobject-objectswithfet