gpt4 book ai didi

ios - 在 iOS 中获取准确位置

转载 作者:可可西里 更新时间:2023-10-31 23:58:32 25 4
gpt4 key购买 nike

我使用此设置设置位置精度:

locationManager.desiredAccuracy = kCLLocationAccuracyBest

然后我得到了这个位置:

if let location = locations.first {
....
}

但是它多次更新位置,其中很多都不准确。例如,当我找到位置时,它距离设备位置大约 100 米。

如何获得准确的位置?

我知道在设备修复位置之前,前几个位置并不准确。

最佳答案

来自 the documentation :

The receiver does its best to achieve the requested accuracy; however, the actual accuracy is not guaranteed.

因此,您无法保证检测到的位置有多接近,但您可以尝试其他一些事情:

  1. 使用 kCLLocationAccuracyBestForNavigation .这应该能让您获得更准确的读数,但会消耗更多电池。

  2. 过滤位置,但我不知道这是否可行,因为您拥有的唯一数据是从您正在使用的位置管理器收到的数据。

关于ios - 在 iOS 中获取准确位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46407728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com