I’ve been working on a new app lately, and I’ve taken this time to try and teach myself CoreData. CoreData is the mechanism by which Apple has taken traditional SQL database and mapped it to the programming model used in iOS apps. Over the next few blog entries I will try and describe my learning process, in the hope that it will help others pick up CoreData. Also, I hope to start a dialog to help others, and myself, work thru any challenges which come up during this process.
If you are just starting, I find that Apple’s Core Data template app, is always a good way of understanding how it is all pulled together. So let’s give that a shot by starting with a MasterDetail Application. To do this, create a new Project and select Master Detail:
After you select that, fill in the next screen. I have chosen to create a Universal Binary since I think you should always start from there, it exposes you to the ins and outs of MVC (Model View Controller). Don’t forget to chose CoreData and Automatic Reference Counting.
After choosing the location for the project… give it a compile. You should have a working CoreData application, that can render on either the iPad or iPhone simulator.
As you can see from the following screen shots both the iPad:
and the iPhone:
So what do we really have here? We have a simple app that if you click the plus will create a new record (date time stamp) and a detail screen that will show that time stamp.
That’s pretty much it.
In the next post I will go a bit deeper on all the files that Apple created for you automatically when you chose this template.