• 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: Coredata - populating initial data on app load - best practices
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coredata - populating initial data on app load - best practices


  • Subject: Re: Coredata - populating initial data on app load - best practices
  • From: mmalc crawford <email@hidden>
  • Date: Mon, 3 Mar 2008 08:44:12 -0800


On Mar 3, 2008, at 8:31 AM, Jason Kravitz wrote:

So given the 3 options in this article, any guidelines for when one is
more beneficial than another?

It depends primarily on your situation.

   * You can create the managed objects directly in code (as
trivially illustrated in NSPersistentDocument Core Data Tutorial).


If you can easily generate the data programmatically, then this may be most efficient. But it may be the least flexible approach with highest maintenance cost.


   * You can create a property list—or some other file-based
representation—of the data, and store it as an application resource.
When you want to use it, you must open the file and parse the
representation to create managed objects.

For non-trivial data which you may want to update periodically, this may be the easiest approach -- unless you also need to create relationships between the objects which may be more difficult to represent. Given a simply-structured text file or plist, you can easily see and edit the contents.

   * You can create a separate persistent store that contains the
default data. When you want to use it, you must copy the objects from
the defaults store to the newly-created store.

This is in some respects the most complex, since you have to copy managed objects from one store to another -- and you have to make sure you update the store every time you alter your schema -- but offers most flexibility.
Although in some cases this might be the easiest approach of al if you can simply copy the default store as a file to the new location.


mmalc

_______________________________________________

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


References: 
 >Coredata - populating initial data on app load - best practices (From: "Jason Kravitz" <email@hidden>)
 >Re: Coredata - populating initial data on app load - best practices (From: mmalc crawford <email@hidden>)
 >Re: Coredata - populating initial data on app load - best practices (From: "Jason Kravitz" <email@hidden>)

  • Prev by Date: Re: Coredata - populating initial data on app load - best practices
  • Next by Date: Re: Typing attributes and the location of the insertion point
  • Previous by thread: Re: Coredata - populating initial data on app load - best practices
  • Next by thread: Re: Combining NSLineBreakByWordWrapping + NSLineBreakByTruncatingTail in NSTextView
  • Index(es):
    • Date
    • Thread