繁体   English   中英

如何在iOS 6中使用Apple地图查找两个位置之间的距离?

[英]How to find the distance between two locations using Apple maps in iOS 6?

我的要求是在不使用Google API的情况下找到两个位置之间的距离(以英里为单位)。 我将代码添加为:

CLLocation* first = [[CLLocation alloc] initWithLatitude:35.779702 longitude:-78.641746];
CLLocation* second = [[CLLocation alloc] initWithLatitude:40.723779 longitude:-73.991289];

CLLocationDistance distance = [first distanceFromLocation:second];
NSLog(@"distance  in Miles ::%f",distance*0.00062137);

它给出的距离为424.151386,但是当我在iPad中签到时,它给出了497英里。

请给我解决这种差异的方法。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM