You cannot use sortedArrayUsingSelector: Use sortedArrayUsingComparator: and implement the comparison block yourself.
It looks like q / a:
Changing the sort order - [NSArray sortedArrayUsingComparator:]
(Actually this question code can be copied / pasted into your code and it will βjust workβ as soon as you change it from integerValue to doubleValue for four calls with converting a string to a number):
NSArray *sortedArray = [array sortedArrayUsingComparator: ^(id obj1, id obj2) { double n1 = [obj1 doubleValue]; double n2 = [obj2 doubleValue]; if (n1 > n2) { return (NSComparisonResult)NSOrderedDescending; } if (n1 < n2) { return (NSComparisonResult)NSOrderedAscending; } return (NSComparisonResult)NSOrderedSame; }];
source share