Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing NSDocument data in packages/bundles



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Storing NSDocument data in packages/bundles (From: Markus Spoettl <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.