{
"restaurant name" : "str1",
"distance": 19.4
}
{
"restaurant name" : "str2",
"distance": 2.1
{
"restaurant name" : "str3",
"distance":19.3
}
{
"restaurant name" : "str4",
"distance": 2.1
}
Above is my array of dictionary values restaurant name and key. I have used following code but it is not sorting properly. It is showing sequence 19.3 ,19.4, 2.1, 2.1. I think it is comparing only first digit
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:kRestaurantListDistance ascending:YES selector:@selector(compare:)];
[restaurantList sortUsingDescriptors:[NSArray arrayWithObjects:sortDescriptor, nil]];
Please tell me proper code to sort out array in ascending order.