Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Fetching Objects from the NSManagedObjectContext
While this chapter’s exercise demonstrates the power of bindings combined with Core Data, it is not uncommon to use Core Data programmatically.
In order to fetch objects from the NSManagedObjectContext you will first need to create an NSFetchRequest. A fetch has a number of similarities to NSArrayController, except that it is typically only used once, while an array controller is continuously updated.
At a minimum you will need the name of the entity you want to fetch. Without anything more, the fetch request will return all of the objects for that entity name. You will usually want to filter and order the results, however. For that you will provide an NSPredicate and/or an ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access