Benim uygulamalarda iki yer arasındaki sürüş (yürüyüş) mesafe almak için MKDirections kullandı.
CLLocationCoordinate2D startCoordinates = YOUR_START_COORDINATES;
CLLocationCoordinate2D endCoordinates = YOUR_END_COORDINATES;
MKPlacemark *startPoint = [[MKPlacemark alloc] initWithCoordinate:startCoordinates];
MKPlacemark *endPoint = [[MKPlacemark alloc] initWithCoordinate:endCoordinates];
MKMapItem *startItem = [[MKMapItem alloc] initWithPlacemark:startPoint];
MKMapItem *endItem = [[MKMapItem alloc] initWithPlacemark:endPoint];
MKDirectionsRequest *request = [[MKDirectionsRequest alloc] init];
request.source = startItem;
request.destination = endItem;
request.transportType = MKDirectionsTransportTypeAutomobile; //here you can choose a transport type you need
MKDirections *direction = [[MKDirections alloc] initWithRequest:request];
[direction calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse * _Nullable response, NSError * _Nullable error) {
if (response) {
for (MKRoute *route in response.routes) {
NSLog(@"Distance : %f", route.distance);
}
}
}];
Eğer adres olarak size yeri varsa, böylece adres Eğer enlem verecektir CLGeocoder metodunu ve boylam kullanabilirsiniz
- (void)geocodeAddressString:(NSString *)addressString completionHandler:(CLGeocodeCompletionHandler)completionHandler;
Google Maps'i kullanarak biriyle MKDirections kullanarak bir sürüş mesafesi sonucunu karşılaştırırsanız, onlar farklı olduğunu göreceksiniz. Bu konu ile ilgili arama ve aşağıdaki bağlantıdan karşıdan karşıya geldi http://www.macworld.co.uk/review/reference-education/apple-maps-vs-google-maps-3464377/
Apple kendi harita hizmetini iyileştirmek kaydedilmesine rağmen, yine de en azından sürüş mesafesi ile ilgili bir soruya Google (IMO) e doğruluk ödün. Eğer Apple ile birlikte takip böylece Yani eğer doğruluk, senin durumunda çok önemli değildir. Aksi takdirde Google API kontrol öneriyoruz.