Creating Your Fetch Request
The object used to fetch managed objects in Core Data is called NSFetchRequest
. Refer to ICFFriendChooserViewController
in the sample app. This view controller displays the friends set up in Core Data and allows the user to select a friend to lend a movie to (see Figure 13.6).
To get the list of friends to display, the view controller performs a standard fetch request when the view controller has loaded. The first step is to create an instance of NSFetchRequest
and associate the entity to be fetched with the fetch request:
NSManagedObjectContext ...
Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.