01.02.2014 Views

Objective-C Fundamentals

Objective-C Fundamentals

Objective-C Fundamentals

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Building the PocketTasks application<br />

237<br />

Figure 12.2 The tasks relationship for the Person entity. Relationships can be optional and point to many entities<br />

(for example, one person can have many tasks). Notice the inverse relationship that points back to the person.<br />

Figure 12.3 The person relationship for the Task entity. It isn’t optional (a task has to belong to a person), and it<br />

points to only one person, not to many.<br />

12.4.4 Creating Person entities in pure code<br />

Now that the Core Data stack and the data model are set up, let’s start using them!<br />

Instead of focusing too much on building a pretty UI, you first add some data programmatically<br />

and also read data programmatically and output it to the Console.<br />

You’ll make it pretty later.<br />

Open PocketTasksAppDelegate.h and add the two methods from the following listing.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!