I am trying to use CoreData in a non-document based (single-coordinator) application. I’ve searched high and low for a good example and tested out a few different ways but -being a complete newbie to Mac OS X development- have been unable to find anything that works.
Basically I have an app where a NSTableView lists a few entries, each of which can be edited and its associated data saved. The data is not document based but should be stored in a “central store” of some sort. I have the model set up nicely and I can populate the items in the table manually. The question is merely this: how can I use CoreData to save the data persistently so that next time the app fires up the data can be loaded up again.
There’s a good one-line summary of what I’m looking for here:
“These applications typically have a single Core Data stack (as defined by a single persistent store coordinator) managed by a single controller object. They generally use a single persistent store for the whole application.”
Are there any good tutorials or quick code samples where I can see how to do this?
Why don’t you create a new xcode project, selecting a cocoa application and checking the use core data flag but not the document based flag, then look at what xcode generated?
Either you replicate that in your project or you move your existing code in the new template.