You need an instance variable to hold the fetched results controller. Add the following declaration below the one for
fetchRequest after the
@implementation statement at the top of
Now you need to initialize the fetched results controller. Doing so requires setting up an appropriate fetch request. This is because
NSFetchedResultsController maps the result of applying a fetch request to a managed object context into index paths.
In Listing 9-2, you used a simple
NSFetchRequest for returning all
CDCar entities. A fetched results controller requires at least a filter and a sort. The filter can ...