How to retrieve a Managed Object in Core Data Fetch Requests

Retrieving Managed Objects is somewhat more complex than creating them, mainly because you can filter what you’re getting back rather than retrieve everything that your store file has to offer.

Let’s first illustrate a basic NSFetchRequest. For the following examples I’m using the iOS Master/Detail template which provides an Entity called Event with a property called timeStamp. I’ve created custom subclasses for this entity. Press the add button a few times so we have some data, then quit the application.

Basic Fetch Request

Here’s how we can retrieve all our values using a basic Fetch Request:

This content is for members only.

Jay is the founder of Pinkstone Pictures and WP Hosting. He has been developing iOS Apps since 2011, 9 of which have made it to the App Store. In his spare time he likes to develop WordPress plugins or drawing on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.