ios - 使用 CLLocationManager 检测何时达到最佳定位精度

标签 ios core-location cllocationmanager cllocation

我目前正在开发一款使用精度最低 (kCLLocationAccuracyThreeKilometers) 的 CLLocationManager 的应用。但是,每隔几分钟我需要获取用户的准确位置,因此我在计时器到期时将精度设置为 kCLLocationAccuracyBest。

显然,CLLocationManager 开始更新位置,逐步从不准确的位置到更准确的位置。然而,问题是我不知道如何检测何时达到了最佳定位精度,所以我永远不知道何时可以使用最佳定位。

有人知道这个问题的解决方案吗?将不胜感激。

最佳答案

CLLocationManagerDelegate 中方法 locationManager:didUpdateLocations:看看 horizontalAccuracyCLLocation .这将为您提供以米为单位的半径。

如文档中所述:

The radius of uncertainty for the location, measured in meters. (read-only)

位置管理器会不断尝试尽可能获得最佳准确度,因此您必须决定位置何时足够准确。

关于ios - 使用 CLLocationManager 检测何时达到最佳定位精度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18511543/

相关文章:

ios - 为什么调整应用程序的 postinst 脚本因为应用程序图标消失了?

iOS 约束样式 : addConstraints vs . isActive = true

ios - 如何删除内容和弹出箭头之间的白色区域ios

ios - 在后台持续更新 iOS 位置

iphone - 位置服务 iOS 提醒回调

objective-c - 获取当前时间

ios - 在使用 Xcode 9 为 iOS 11 设备构建的应用程序上出现间歇性和延迟的重要位置更改事件

ios - 如何在 iOS 8 的 CLLocationManager 中启用 "When app in use"

iOS:应用程序挂起状态下的位置更新

ios - 使用 iOS Core Location Manager 时模拟位置