XCode 4: CoreData Tab Bar Application template

Hi,

When apples released its XCode application, it never added CoreData support to the Tab Bar Application template… although, in my case I usually want this feature. So… now I need to create a Tab Bar Application and a Window-based Application and copy the CoreData stuff from one to the other.
This is, off course, very annoying. So, what I want is to adapt the current templates to support even Core Data… “F*cking hell, this is most likely a mess to get working”… but I was wrong.
It is much easier to do in XCode 4 then it is in XCode 3.x. I am not going to cover XCode 3 cause I have gone over to the dark side (= XCode 4).

What I am going to do is adapt the current Tab Bar Application template to show the “Use Core Data” checkbox when creating a new project. I am not adding any unit tests or any functionality to add data to the core data (SQLlite) DB. Just making sure the functionality exists.
To get this checkbox in XCode 4 when creating a Tab Bar Application, have to add 1 line to the template file. I assume you have installed XCode using the default location. If so, open:

/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project\ Templates/Application/Tab\ Bar\ Application.xctemplate

No, in this directory you will find a file called “TemplateInfo.plist”. Open this file.
When opened, add the following line on row 8 (just below <string>com.apple.dt.unit.cocoaTouchFamiliedApplication</string>):

<string>com.apple.dt.unit.coreDataCocoaTouchApplication</string>

Save the file and restart XCode… it should now be working. Now you can create Tab Bar Application with Core Data from the template. Voila! :)

Best regards,
Paul Peelen


16 Responses to “XCode 4: CoreData Tab Bar Application template”

Leave a Reply