Setting Up the Fetch Request

A fetch request describes how you want to search through data. This process starts by retrieving an entity description for a given entity name. For the Person entity, that name is @"Person". The description specifies what kinds of data you want to search for.

Create a new fetch request, initializing it with the entity description you just retrieved and a batch size. A 0 batch size corresponds to an indefinite request. If you want to limit the number of returned results, set the batch size to a positive number.

Each request must contain at least one sort descriptor. This method sorts in ascending order (ascending:YES), using a sort key. As with the entity name, the sort key is a string (for example, @"surname"). Set ...

Get The Core iOS Developer’s Cookbook, Fifth Edition 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.