You don't return
a value from your comparator block:
aReturnVal = [aToolsInfoArray sortedArrayUsingComparator:^(id a, id b) {
NSDictionary *adict = (NSDictionary *)a;
NSDictionary *bdict = (NSDictionary *)b;
return [[adict objectForKey:@"selectionCount"] compare:[bdict objectForKey:@"selectionCount"]];
}];
(plus use objectForKey
rather than valueForKey
, which is the KVC accessor).
EDIT Missed the block syntax you were using is incorrect too (thanks to @Ivan Genchev).