Re: Core Data and Document Packages
Re: Core Data and Document Packages
- Subject: Re: Core Data and Document Packages
- From: Kevin Hoctor <email@hidden>
- Date: Wed, 4 Jul 2007 11:02:50 -0500
On Jul 3, 2007, at 3:38 AM, Seth Willits wrote:
I'm taking the plunge and switching a fair chunk of code to using
Core Data instead of my own management of an SQLite database. At
least that's the current plan. ;)
My document-based app has a document type which uses a package
instead of just a single file to store data in, because there is a
need to store related files inside the package as well. Currently
I'm doing some relatively simple overloading of standard NSDocument
methods to open and save the database by using a path based off of
the -fileName.
With NSPersistentDocument, by default it uses the document's -
fileName as the path for the persistent store. What is the best way
to retarget it so that it uses a different path within the package?
I imagine someone here must have done it, so I'm hoping to not have
to fiddle for so long to figure it out, however it seems that I
might simply be able to override
configurePersistentStoreCoordinatorForURL:ofType:error: and pass a
different URL to super's implementation? Will there be any side
effects to this?
Seth,
I've thought about having files associated with my Core Data database
as well and I came up with a different solution that may work for you
as well. Instead of trying to keep the files with the database, you
could designate a folder as a repository for the files. This can even
be a user-preference to relocate this folder. This way you avoid all
the stress of trying to roll them into the database.
The other option, if the files are small enough, is to actually store
them in a Binary Data field of a database table.
Peace,
Kevin Hoctor
email@hidden
No Thirst Software LLC
http://nothirst.com
_______________________________________________
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