Re: code data export import strategies
Re: code data export import strategies
- Subject: Re: code data export import strategies
- From: Rob Keniger <email@hidden>
- Date: Mon, 9 Nov 2009 12:23:12 +1000
On 09/11/2009, at 5:18 AM, Martin Hewitson wrote:
> I've been digging around for export and import strategies to allow me to export parts of a core data model. In more detail, I have a set of categories, each of which contains a set of meetings. Each meeting has a fairly complex object graph below it (agenda, agenda items, location, title, etc). I want to allow the user to export a meeting which can then be imported by someone else using the same application.
>
> Does anyone have any good advice how best to approach this? I was considering making the NSManagedObject subclasses conform to NSCoding, but I read in a couple of places that this was difficult to do, particularly the initWithCoder: part. Anyone tried this already?
Yes, I've done this. What I did is create a second NSManagedContext with a separate NSPersistentStore and copy the relevant objects out of the main NSManagedContext into the new one. You basically do the reverse on import.
There is an excellent example of how to handle import and export in Marcus Zarra's Core Data book:
http://pragprog.com/titles/mzcd/core-data
I highly recommend getting a copy if you're working with Core Data.
--
Rob Keniger
_______________________________________________
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