Re: Persistent Stores and Packages ...
Re: Persistent Stores and Packages ...
- Subject: Re: Persistent Stores and Packages ...
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 23 May 2005 17:17:26 -0700
On May 23, 2005, at 10:41 AM, mmalcolm crawford wrote:
On May 23, 2005, at 9:42 AM, SA Dev wrote:
- The first is how to get my XML store (which is saving and
opening just fine right out of the box) to be saved to and read
from a package. What do I fudge with? Subclass a context, a
persistent store, or will NSPersistentDocument do everything I
need it to if I only override the correct methods? I'm aware I
have to check the "Package" checkbox in my document types (I have
a document with my chosen extension and a unique UTI, XML store
type). What reference material can help me with this? Has anyone
tried this yet?
From <http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/ObjC_classic/Classes/NSPersistentDocument.html#//
apple_ref/occ/cl/NSPersistentDocument>
"You can customize the architecture of the persistence stack by
overriding the methods managedObjectModel and
configurePersistentStoreCoordinator:forURL:ofType:error:. You might
wish to do this, for example, to specify a particular managed
object model, or to distribute storage of different entities among
different file stores within a file wrapper."
- The second problem may be answered by the first problem's
solution. I need to know how my NSManagedObject subclasses can ask
their document for the package path (so, say, a "StoredImage"
object can write itself to the package's Stored Images subfolder
on -willSave and load/cache it again when its imageData is asked
for. Or is this not the best way to do it? Let me elaborate ...
Again start with
configurePersistentStoreCoordinator:forURL:ofType:error: -- see
also <http://developer.apple.com/documentation/Cocoa/Conceptual/
NSPersistentDocumentTutorial/index.html>
Bah, my apologies. :-((
No, this won't work. There's an "issue" with the interaction between
NSDocument and NSPersistentDocument such that file packages/wrappers
don't play well together. This is a "known issue". There isn't a
workaround short of creating your own document architecture...
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden