Tutorial :Adding Core Data to an existing iPhone app


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


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.


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.


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.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »