NSSortDescriptor
distance
小于 10.0时订购不正确。
代码(按距离排序数组):
// Order Array by Distance (Distance = NSString)
NSSortDescriptor *aSortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"distance" ascending:YES];
[_contentData sortUsingDescriptors:[NSArray arrayWithObject:aSortDescriptor]];
正确排序(当距离值 > 10.0 时):
(
{
distance = "11.256649";
},
{
distance = "257.428821";
},
{
distance = "4534.256851";
}
)
错误排序(当任何距离值 < 10.0 时):
(
{
distance = "252.428821";
},
{
distance = "4514.256851";
}
{
distance = "8.362996"; // Wrong ordering when distance < 10.0
},
)