• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: code data export import strategies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: code data export import strategies


  • Subject: Re: code data export import strategies
  • From: Martin Hewitson <email@hidden>
  • Date: Mon, 9 Nov 2009 08:03:26 +0100

Thanks, Rob. I do have this book, but I sort of skipped the section about multithreading (where the export example is buried), but I've found it now.

Thanks to the others who replied as well. I think this has set me on the right track.

@Jerry: I chose not to use a document-based design because I want all the meetings and categories to be available as a list in the app, rather like Mail.app with mailboxes and messages. Then a 'normal' core- data app seemed more appropriate to me.

Martin

On Nov 9, 2009, at 3:23 AM, Rob Keniger wrote:


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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: email@hidden WWW: http://www.aei.mpg.de/~hewitson ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





_______________________________________________

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


  • Follow-Ups:
    • Re: code data export import strategies
      • From: Rob Keniger <email@hidden>
References: 
 >code data export import strategies (From: Martin Hewitson <email@hidden>)
 >Re: code data export import strategies (From: Rob Keniger <email@hidden>)

  • Prev by Date: Re: NSTreeController and object retain counts
  • Next by Date: Re: beginner question, NSNumber, NSDecimalAsNumber
  • Previous by thread: Re: code data export import strategies
  • Next by thread: Re: code data export import strategies
  • Index(es):
    • Date
    • Thread