Hi all, I got an array in my app and I need to order by one of its key.
Basically what the app does is taking latitude and longitude somewhere, calculate the distance from my actual position and create an array containing a key called "distance".
I'm using
myArray sortUsingDescriptors:
[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"distance" ascending:YES] autorelease]]];
I'm not sure it's working, I mean the first results are ordered but then it shows distance closer to the previous, as example:
0.8 km
1.6 km
1.9 km
10053.9 km
1098.0 km
2372.0 km
470.5 km
Any suggestion?
I thank you in advance for any kind of help.
Fabrizio