我使用 CLLocation 的distanceFromLocation
方法计算2个位置之间的距离,如下所示。它在iOS 8和iOS 9之间返回不同的结果
谁知道为什么?感谢。
CLLocation *locationA = [[CLLocation alloc] initWithLatitude:39.861667 longitude:-104.673167];
CLLocation *locationB = [[CLLocation alloc] initWithLatitude:33.942500 longitude:-118.408075];
// Calculate distance between 2 locations
CLLocationDistance routeDistance = [locationA distanceFromLocation:locationB];
NSLog(@"Distance A - B : %f", routeDistance);
==>结果:
距离A - B:
iOS 8: 1383761 .019303
iOS 9: 1387015 .203345