When do I use a NSFetchedResultsController in comparsion to the objectsWithFetchRequest method in NSManagedObject? Are there typical scenarios?
When do I use a NSFetchedResultsController in comparsion to the objectsWithFetchRequest method in NSManagedObject?
Share
objectsWithFetchRequest:(orexecuteFetchRequest:error:) just executes a fetch request and returns the result set.A
NSFetchedResultsControllerexecutes 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
NSFetchedResultsControlleris 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.