Fetching

Fetching is the term used to describe the resolving of NSManagedObject objects from the repository. When we retrieve an NSManagedObject, it is “fetched” into memory, and we can then access its properties. To help us utilize memory efficiently, fetching may not always happen all at once. Specifically, when we’re using a SQLite store, it’s quite possible that an object we think is in memory is actually only on disk and has yet to be read into memory. Likewise, objects that we think we’re done with may actually still sit in a cache.

To demonstrate the differences in the ways that we can load data into memory from our SQLite Store, I ran a number of tests using one of Apple’s older demonstration application from a previous Worldwide Developer ...

Get Core Data in Objective-C, 3rd 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.