Re: Storing NSDocument data in packages/bundles
Re: Storing NSDocument data in packages/bundles
- Subject: Re: Storing NSDocument data in packages/bundles
- From: "Kyle Sluder" <email@hidden>
- Date: Wed, 31 Dec 2008 03:57:29 -0500
On Wed, Dec 31, 2008 at 3:51 AM, Markus Spoettl
<email@hidden> wrote:
> My app stores a lot of data in a document, potentially hundreds of
> megabytes. The problem with using single files and NSKeyedArchiver is that
> one has to write everything, even if only a tiny part of the structure
> changed. My data is clustered into handy little pieces which could be saved
> into their own separate files within the package.
Have you thought of using Core Data instead? This is what the SQLite
store is designed to address.
> The problem is that - if I understand it correctly - when using file wrapper
> -fileWrapperOfType: of NSDocument, I always have to provide the complete
> wrapper, including all contained wrappers. That of course is exactly what I
> hoped to avoid because it means I'd have to write all data (this time into
> separate files/wrappers).
That is correct. You have to implement -readFromURL:ofType:error: and
-writeToURL:ofType:forSaveOperation:originalContentsURL:error: if you
want to go the document-package route and not wind up with wholesale
writing. This means, of course, that you need to be able to tell what
has changed in the document, and then be able to determine which
fragments need to be updated on disk.
--Kyle Sluder
_______________________________________________
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