XCode 4: CoreData Tab Bar Application template


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:

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>):

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

Posted in Apple, Objective-c, XCode Tagged with: , , , , , ,
16 comments on “XCode 4: CoreData Tab Bar Application template
  1. Djseek says:

    Nice! This saved me a lot of time.

  2. Mircea says:

    Thanks! It worked. That was so stupid from Apple not to include Core Data in Tab Bar Application Template

  3. Paul Peelen says:

    Glad to hear it is of use 🙂

  4. Derek Knight says:

    You are a real star. A simple fix but a huge benefit. You deserve a medal. Thanks a lot

  5. sourish says:

    hi Paul,
    Do u have any other code like the one u have given for Heallo WOrld program, if so can u publish those

  6. Herm says:

    saved me a headache and a lot of redbull.. thx alot.

  7. David says:

    Amazing, thank you!

  8. Barbara says:

    Hi, I use XCode 4.3.2. and I have looked everywhere I cannot find a folder with the name.In Developer there is only a Documentation folder not a Library Folder. Where could I find the predefined templates instead?

  9. Paul Peelen says:

    The latest XCode has moved this from the /Developer folder to the /Applications folder. GĂĽ to the XCode.app file and right click it. Choose “Show content” and browse there. Just from the top of my head I cannot remember where it is located, but will look it up tonight and update the post (or write a new one).

  10. Shimon Pozin says:

    Use “/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/Application/Tabbed Application.xctemplate” and don’t forget to use sudo to edit file (it’s readonly by default)

  11. schalk says:

    Hi there I found the file but how do you edit it?
    Also the com.apple.dt.unit.coreDataCocoaTouchApplication
    is not there anymore?

  12. Joachim says:

    Thank you very much!

  13. rcutshaw says:

    Fantastic tip! Works across the board with the project templates. Thanks much.

  14. Michele says:

    I dont know why for me is not working.. any Tips?


  15. Paul Peelen says:

    You’ll have to give me some more info… what is the problem?

Leave a Reply

Your email address will not be published. Required fields are marked *