Fetch request

A fetch request tells a managed object context the entity of the managed objects that you want to fetch; optionally, it specifies other aspects such as constraints on the values the objects' properties must have and the order you want the objects returned in. A fetch request is an instance of NSFetchRequest. The entity it specifies is represented by an instance of NSEntityDescription; any constraints are represented by an NSPredicate object, and the ordering by an array of one or more instances of NSSortDescriptor. These are akin to the table name, WHERE clause, and ORDER BY clauses of a database SELECT statement respectively.

You execute a fetch request by sending a message to a managed object context. The context returns an array containing the objects (if any) that matched the request.

Art/fetch_flow_of_data.jpg

Definitive Discussion

    Fetching Managed Objects

Related Articles