summerICEREDTEA 2013-02-18 03:13 采纳率: 63.2%
浏览 3846
已采纳

ios CLLocationManager didUpdateToLocation 经纬度偏移的问题

- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
         fromLocation:(CLLocation *)oldLocation {
    NSLog(@"%f",newLocation.coordinate.latitude);
    self.location = newLocation;
}

得到的经纬度与实际地理位置始终会有偏移 请问这个问题该如何解决?

  • 写回答

3条回答

  • zxd_72 2013-02-18 07:33
    关注

    你应该测试 CLLocation 对象返回值的准确性,确保符合位置的准确性。

    if (newLocation.horizontalAccuracy > 1000) {
      // Throw away this location and wait for another one as this is over 1km away
    }
    

    另外,locationManager:didUpdateToLocation:fromLocation:方法可能在iOS6不可用。所以在iOS6以上版本你应该使用locationManager:didUpdateLocations:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog