Re: NSSortDescriptor and Block

2010-03-24 Thread Ben Trumbull
Well, if you need a nil keypath you probably shouldn't be using sort descriptors. The primary value of sort descriptors are (a) the KVC caching and (b) an OO representation of a sort criteria. The standard -sortedArrayUsingComparator: is for blocks like the one you wrote that are completely

Re: NSSortDescriptor and Block

2010-03-24 Thread Jochen Moeller
Hello Ben, thanks very much for your answer. Your idea with the nil keypath works! So changing the line in question to: NSSortDescriptor *descr3 = [ NSSortDescriptor sortDescriptorWithKey:nil ascending:YES comparator:^NSComparisonResult(id obj1, id obj2) { is sorting the array without claim

re: NSSortDescriptor and Block

2010-03-24 Thread Ben Trumbull
> while experimenting with sorting methods I got a strange error message with > -sortDescriptorWithKey:ascending:comparator:. > > In the following listing (as simple as possible) an Array can be sorted with > -sortedArrayUsingDescriptors: with a selector, and > -sortedArrayUsingComparator: > > B

NSSortDescriptor and Block

2010-03-24 Thread Jochen Moeller
Hello List, while experimenting with sorting methods I got a strange error message with -sortDescriptorWithKey:ascending:comparator:. In the following listing (as simple as possible) an Array can be sorted with -sortedArrayUsingDescriptors: with a selector, and -sortedArrayUsingComparator: But