排序变得混乱

Sorting gets messed up

我已经借助这段代码实现了排序。我面临一个问题。当排序发生时,数字 9 排在 15000 之前。我不知道这是怎么回事。请帮忙!

NSSortDescriptor *lastDescriptor =
            [[NSSortDescriptor alloc]
             initWithKey:@"priceAmount"
             ascending:NO];
id obj;
NSEnumerator * enumerator = [self.messageStore objectEnumerator];
while ((obj = [enumerator nextObject]))
    DebugLog(@"%@", obj);
NSMutableArray *descriptors = [NSMutableArray arrayWithObject:lastDescriptor];
self.messageStore = (NSMutableArray *)[self.messageStore sortedArrayUsingDescriptors:descriptors];

用选择器试试 localizedStandardCompare

NSSortDescriptor *lastDescriptor = [[NSSortDescriptor alloc] initWithKey:@"priceAmount" ascending:NO selector:@selector(localizedStandardCompare:)];