gpt4 book ai didi

iOS如何知道坐标是否正确

转载 作者:行者123 更新时间:2023-11-29 12:06:18 24 4
gpt4 key购买 nike

我正在使用 CLLocationManager 获取位置坐标。

我在用

 - (void)locationManager:(CLLocationManager *)manager 
didUpdateLocations:(NSArray *)locations{
[locations lastObject]
...
}

他们可以获得最后的位置。

但我发现如果我们在初始处获取 lastObject。

位置不是真正的坐标,会漂移。

一段时间后,坐标会收敛到该点。

但是我怎么知道这个值现在真的在当前位置呢?

非常感谢。

最佳答案

您可以使用 CLLocation 对象的 horizo​​ntalAccuracyverticalAccuracy 属性来了解测量的精度。

根据 Apple docs :

水平精度:

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

The location’s latitude and longitude identify the center of the circle, and this value indicates the radius of that circle. A negative value indicates that the location’s latitude and longitude are invalid.

垂直精度:

The accuracy of the altitude value in meters. (read-only)

The value in the altitude property could be plus or minus the value indicated by this property. A negative value indicates that the altitude value is invalid.

只需等待您的水平值减小到合理的阈值,以便考虑坐标精确度。

关于iOS如何知道坐标是否正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34877675/

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