Chapter 4. Setting Up Core Data
In This Chapter
An introduction to Core Data
Looking at managed objects
The Core Data architecture
Adding a Core Data stack
Although property lists are definitely cool, they're far from the universal solution to data management. For example, every time you start the app you still have to build the objects (the dictionaries, arrays, and so on) that you have saved. But more importantly, the real issue is that you can save only property list objects in a property list. That means you can't save relationships between objects.
Although there are some workarounds you can try to save relationships — the code kind, not necessarily the human kind — they can be very cumbersome if you have lots of objects. Imagine if you had 50 or so states in your application, with each one having a number of cities you were planning to visit, and each one of those with a number of hotels and sights. And oh yes, what about undo and redo?
What is really needed here is object persistence — you want to create the object once (along with its links to other objects) and then be able to continue to use it across application launches.
Fortunately there is a great way to create object persistence on the iPhone — Core Data. It's a deep, wide, and very mature technology, used on the Mac for years, which makes the iPhone version very attractive. Core Data makes it easy to create, manage, and delete objects as well as shake to undo and redo.
In fact, Apple is heavily promoting the use of Core Data ...
Get iPhone® Application Development All-In-One For Dummies® 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.