• 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: Populating a new SQLite Core Data store with default data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Populating a new SQLite Core Data store with default data


  • Subject: Re: Populating a new SQLite Core Data store with default data
  • From: "I. Savant" <email@hidden>
  • Date: Thu, 26 Feb 2009 09:54:48 -0500

On Thu, Feb 26, 2009 at 9:02 AM, Jon C. Munson II <email@hidden> wrote:

> Interestingly enough, as I wanted my objects inserted in a particular order,
> I had to call save after each insertion (no big deal as I don't have that
> many records and this is a one-time thing) - the MOC didn't save the records
> in the order I had created them, but inserted them in no particular order
> (at least from the tool I used to examine the tables).  Despite the -save
> being called, a few were still out of order, but not critically so.

  Also clearly spelled out in the Core Data Programming Guide. :-)
Core Data deals with sets, not arrays. A set is unordered. This is
done because of the faulting mechanism. Particularly with the SQLite
store type, for efficiency, sets or subsets of your desired collection
are retrieved (faulted in) as needed. This cannot be ordered.

  If you want to maintain the order of a collection, you need to add a
-sortOrder attribute (or something similar) to your entity and sort
them (either in the fetch or after). There are at least a dozen
threads on this subject in the list archives (many of which I
participated in over the years).

--
I.S.
_______________________________________________

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: 
 >RE: Populating a new SQLite Core Data store with default data (From: Ben Trumbull <email@hidden>)
 >RE: Populating a new SQLite Core Data store with default data (From: "Jon C. Munson II" <email@hidden>)

  • Prev by Date: Re: One IBAction, multiple results from multiple methods
  • Next by Date: Re: noobie mem management problem
  • Previous by thread: RE: Populating a new SQLite Core Data store with default data
  • Next by thread: Re: Populating a new SQLite Core Data store with default data
  • Index(es):
    • Date
    • Thread