如何获得指定精度的一次性位置?
在文档中,它说它获得了一个大概的位置,然后以越来越精细的精度不断更新。我有一个按钮
[locManager startUpdatingLocation];
,然后我实施
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
[locManager stopUpdatingLocation];
}
并让它在某个地方得到指示。由于某种原因,当我开车去某个地方时,它不会更新位置。我认为这是因为它获得了“大致位置”,然后没有足够的时间来获得准确的读数。我也有
locManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
什么想法吗?只需要一次准确的读数。难住了。谢谢。
In the documentation it says that it gets an approximate location and then keeps updating with finer and finer precision. I have a button that does
[locManager startUpdatingLocation];
and then I implement
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
[locManager stopUpdatingLocation];
}
and have it get directions somwhere. For some reason it's not updating locations when I drive somewhere. I would assume this is because it gets the "general location", and then doesn't have enough time to get an accurate reading. I also have
locManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
Any thoughts? just need one time accurate readings. stumped. thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
快速破解解决方案:
更好的解决方案可能是等到准确性停止提高(根据最近 5 次更新的平均值)。
Quick hack solution:
A better solution might be to wait until accuracy stops improving, averaged over the last 5 updates or so.