views:

427

answers:

3

I have started my application and now I want to add Core Data to my app. How can I add it?

+1  A: 

How much code do you have written? It may be simplest to start a new project with the Core Data template, and migrate in your existing code.

Not sure how much experience you have with Core Data, but the default template adds a bit of bloat in my opinion. Be prepared to alter it to suit your needs.

darren
+2  A: 

Unless you've gotten really far into your app, the easiest way will be for you to start a new Xcode project using the Core Data template. If you really don't want to move your code into a new project, you can add the Core Data framework and the necessary boilerplate code in AppDelegate. But really, unless you want to be tinkering for a while, the simplest way is to make a new project with the right template.

Jonathan Sterling
+7  A: 

I disagree that you have to start a new project. It's actually pretty easy to integrate CoreData into an existing project - a good starting point is to create a new CoreData project, but copy the code it generates into your existing project (examine carefully the app delegate to see what it sets up). There's really not that much code involved, and it's easy to create new data models.

It's also a really good idea to work through Apple's CoreData tutorials to understand what is going on, and there are some good books as well.

Kendall Helmstetter Gelner
You don't need to start a new project. For a beginner, though, that's the easiest way. Your suggestion about reading the tutorials to actually understand what is going on is really good, though. Apple's boilerplate code is not always the best way to go.
Jonathan Sterling