Here is the sample project to download.
Core Data is very powerful, but the learning curve is steep. Using Apples Core Data templates doesn’t help much because it encourages “voodoo programming”— that is using code in your application that you don’t understand. That voodoo code might work to begin with, until something crashes, then you caught with your pants down, because you don’t know if it is your code or the voodoo code that caused the crash. In this tutorial series I try to demystify Core Data by taking baby steps, making sure that each step is thoroughly explained.
In the first tutorial called “Introduction to Core Data” we mention different techniques for handling persistence like plists, NSCoding, SQLite and Core Data. We compare SQLite and Core Data and point out the differences. We explain the idea behind Core Data and talk about its infrastructure. We also look at the main classes that make up the Core Data. This tutorial will give you a solid theoretical understanding of what Core Data is, how it is different from SQLite and what the benefits are.
In the second tutorial called “Core Data part 1″ we create a simple application, integrating Core Data with cocos2d, from ground up. You will get practical knowledge of how the different parts of Cored Data work together. You can use the code from this tutorial as a basis for your own Core Data project. This code is fully integrated with cocos2d, is explained in detail, and is transparent.
I have used core data, and found a bug, sent it into apple developer and was confirmed.
Bob, have you come across this ?
I am creating an app that saves images. I want to use core data to save additional information associated with the image. I understand that I should not save large amounts of data within the sqlite file. So for my image attribute in entity I am using binary data, but have also checked the option box that “allows for external storage”.
It works great, but the main issue is that when I view my “sandbox” filesystem, the Core data continues to create folders titled
(A Document Being Saved for ‘appname’)
These contain all my images, and the numbers continue to mount so I have many (A Document Being Saved for ‘appname’) folders .. all full of images. Thus taking up a lot of space.
I have deleted all items in my database, stopped the app in background. Nothing removes these folders and content.
Shouldn’t core data do this automatically ?
Yes they should – this is the bug!
Excellent tutorial Bob, i want to ask what kind of project did you choose under new project (because most of the code and formatting was already done, please dont mind if this is a stupid question i am new to Xcode and your tutorials have been a great help)
Hi Ahmad,
Just the normal cocos2d, although I pruned it from some comments.
Bob
One of your best tutorials Bob.
Keep up the amazing work!
Great introductory tutorial – highly recommended for Core Data novices. Do you have a date in mind for “Core Data part 2″?
Yes I will do” Core Data part 2″ and also “Core Data part 3″
Bob, thank you for this tutorial, it is a big black box to me at the moment and your tutorial is helping lift the darkness!
Did/have you done tutorials 2/3?
Thanks
Mike
Not yet Michaeli, but I’m planning to
Bob
Can you add the xCode project to Download plz, and good job man, thanks for doing this.
I’ve added it.
Thanks man