Re: Core data model persistence, independent of document
Re: Core data model persistence, independent of document
- Subject: Re: Core data model persistence, independent of document
- From: Jerry Krinock <email@hidden>
- Date: Fri, 21 May 2010 22:55:53 -0700
On 2010 May 21, at 11:30, James Maxwell wrote:
> I built a model that seems about right, to me, but I can't seem to bind it to anything
I don't know how you "bind it [a model]". The only thing which you can bind are bindings. Admittedly, the terminology is very confusing and the word "binding" in particular has several definitions. But you've got to read the Cocoa Bindings documentation and learn it.
> I've been looking around at various Core Data tutorials, and I noticed that they're either for document-based apps, or they're created from a template, which I guess must provide the appropriate AppDelegate (at least, that's implied by one of the tutorials, at mactech.com). My app is document-based, but I don't want this data stored with the document -- it should persist across all documents, pretty much like a user default
Although your stated requirement of persistent application data as well as persistent document data is fairly common in real life, Apple's Core Data tutorials are fairly simple and do not demonstrate this. But it's straightforward. You can have a persistent store in ~/Library/Application Support, as well as one in each document.
> (and besides, I'm subclassing GCDrawKit's "DKDrawingDocument" already).
DKDrawingDocument inherits NSDocument, not NSPersistentDocument. Therefore, you're not going to get a Core Data document. By the way, this might also be the reason why whatever it is you're binding doesn't find a managed object context in whatever it is you're binding to. You could try changing the declaration of DKDrawingDocument to make it inherit from NSPersistentDocument, but I expect that a lot of pain might lie ahead.
> I get the same error when binding to Shared User Defaults, so I'm kinda stumped...
Again, no one can figure out what you're "binding".
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden