Alex Rivera | Logout

Coredata and NSOrderedSet - how is the order of the set defined?

Asked 2012-02-29T10:47:56.030
8

I had a look through the existing documentation and couldn't find anything that confirms the behaviour I am seeing.

Starting on iOS 5, CoreData relationships can be ordered and in this case the returned object is a NSOrderedSet.

Can anyone confirm that the order of the objects in the set matches the order in which they have been created?

Cheers, Rog

Edit
Report

1 Answer

2

If you don't sort the order yourself using sortedArrayUsingComparator: then I believe the objects are sorted in the order in which they are added.

You can also manual set the order with with – insertObject:atIndex: .

https://developer.apple.com/library/mac/#documentation/Foundation/Reference/NSMutableOrderedSet_Class/Reference/Reference.html#//apple_ref/occ/cl/NSMutableOrderedSet

answered 2012-02-29T10:58:23.877

Your Answer