I started off the project without Core Data and now I would like to add that functionality to my apps. How do I do this?
What additional things does XCode sets up when you actually tick the Use Core Data when you create a new project?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One trick is to just create a new empty project with Core Data support. That will give you the necessary code that you can copy over to your original project and compile.
The only gotcha is that you need to handle the Core Data header file. Xcode puts it in the precompiled header files when it generates files using the templates. So you can add the following line to your .pch file:
or you can just add it to the .m files where needed.
It works like a charm. Notice Luka’s comment below about how to do it in Xcode5.