• 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 Best Practices
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData Best Practices


  • Subject: Re: CoreData Best Practices
  • From: John Timmer <email@hidden>
  • Date: Fri, 29 Apr 2005 17:28:12 -0400

Sorry, didn't quite finish up my thought - got distracted by a phone call.

If you need to hold a more complex object (like a dictionary), model it as a
Core Data object, but include a field for a unique identifier (either string
or NSNumber).  Store that unique identifier in the array, and use it to
retrieve the appropriate "author" entry.

The alternative to this would be to have a location field in the author
object, so that you could use it to sort the set.

Neither of these are great solutions, but both work pretty well.

JT

> If you decide you absolutely need an array of strings, there's a way to do
> it:
>
> Subclass NSManagedObject and add an array ivar
> Make array retrieve/add/delete methods
> Have keyed value that's a string or data
>
> When the array changes, have it save its string representation or coded data
> to the keyed value.  If the array is requested when its ivar is nil, use
> simply re-create it from the keyed value.
>
> There's going to be a problem with large arrays, so this might be painfully
> slow with the human genome publication, but it's fine for most instances.
>
_______________________________________________
This mind intentionally left blank


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: CoreData Best Practices (From: John Timmer <email@hidden>)

  • Prev by Date: Re: Saving Images with Core Data (i.e., JPEG, TIFF, etc.)
  • Next by Date: Re: Saving Images with Core Data (i.e., JPEG, TIFF, etc.)
  • Previous by thread: Re: CoreData Best Practices
  • Next by thread: Re: CoreData Best Practices
  • Index(es):
    • Date
    • Thread