getDistanceFrom Şimdi işte artık kullanılmamaktadır Bunu yapmak isteyen herkes için alternatif bir yanıt.
CLLocationCoordinate2D pointACoordinate = [pointAAnnotation coordinate];
CLLocation *pointALocation = [[CLLocation alloc] initWithLatitude:pointACoordinate.latitude longitude:pointACoordinate.longitude];
CLLocationCoordinate2D pointBCoordinate = [pointBAnnotation coordinate];
CLLocation *pointBLocation = [[CLLocation alloc] initWithLatitude:pointBCoordinate.latitude longitude:pointBCoordinate.longitude];
float distanceMeters = [pointALocation distanceFromLocation:pointBLocation];
float distanceMiles = (distanceMeters / 1609.344);
[pointALocation release];
[pointBLocation release];
Yukarıda olduğu gibi, kullanabilirsiniz floatyerine doubleve kesinliğini gerektirmeyen eğer bir int sonuçları döküm olabilir floatşöyle:
int distanceCastToInt = (int) [pointALocation distanceFromLocation:pointBLocation];
intBunu gibi ek açıklamada mesafenin kaba bir fikir vermek istiyorsa kullanışlıdır:
pointAAnnotation.title = @"Point A";
pointAAnnotation.subtitle = [NSString stringWithFormat: @"Distance: %im",distanceCastToInt];
örneğin: "50 milyon uzaklık" ek açıklama altyazı okurdu.