objective-c - startMonitoringSignificantLocationChanges 缺乏准确性

标签 objective-c ios core-location

我正在开发一个具有以下要求的简单应用:任务将在给定位置开始,当用户离开一定距离后,任务应自动结束。

我目前正在使用 CLLocationManager 的 startUpdatingLocation 来获得 100 米精度以内的初始 GPS 位置。这很好用。

然后我使用 CLLocationManager 的 startMonitoringSignificantLocationChanges 来确定用户是否走得足够远。我使用这种方法是因为它的电池生命周期更好,可以在后台运行等。

现在,我遇到的问题是使用 startMonitoringSignificantLocationChanges 时返回的位置的准确性。如果我只是让我的手机放在我的 table 上,等待 10-20 分钟,它会自动结束任务,因为从 startMonitoringSignificantLocationChanges 返回的位置准确(或不准确)。例如:

2011-11-27 20:21:44.653 MyApp[2692:707] Location manager wants 100.000000 meter accuracy
2011-11-27 20:21:44.655 MyApp[2692:707] Location manager got 99.260482 meter accuracy
2011-11-27 20:27:52.975 MyApp[2692:707] visit location: lat 43.619912 long -70.237781
2011-11-27 20:27:52.977 MyApp[2692:707] current location: lat 43.619808 long -70.237561
2011-11-27 20:27:52.981 MyApp[2692:707] moved 21.155182 meters from visit origin
2011-11-27 20:37:53.205 MyApp[2692:707] visit location: lat 43.619912 long -70.237781
2011-11-27 20:37:53.207 MyApp[2692:707] current location: lat 43.628081 long -70.231727
2011-11-27 20:37:53.211 MyApp[2692:707] moved 1030.822457 meters from visit origin

以上都是在我移动设备一英寸的情况下发生的。我的直觉是 startMonitoringSignificantLocationChanges 不够准确,无法满足此要求。是这样吗?还是我可能忽略了什么?

如有任何反馈,我们将不胜感激。我没有发布任何代码,但都是非常基本的 CLLocationManager 内容。如果需要更多信息或代码片段,请告诉我。

提前致谢!

最佳答案

来自 the CLLocationManager docs :

This interface [e.g, startMonitoringSignificantLocationChanges] delivers new events only when it detects changes to the device’s associated cell towers, resulting in less frequent updates and significantly lower power usage.

因此,startMonitoringSignificantLocationChanges 不太可能用于检查您所寻找的准确度级别的位置 - 手机信号塔很少能如此准确地定位您。您可能想尝试使用 startMonitoringForRegion:desiredAccuracy: 代替;它还在后台运行,并会为您完成大量 HitTest 区域的肮脏工作。

关于objective-c - startMonitoringSignificantLocationChanges 缺乏准确性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8290707/

相关文章:

objective-c - @protocol 与类集群

ios - 解析查询 - 将 OR 语句与 AND 组合

ios - 在iOS中将mach_absolute_time转换为(nano)秒(objective-C)

ios - 无法添加文件 iOS 应用程序包

ios - 我能否访问我的应用程序沙箱范围之外的其他 iOS 应用程序的信息?

iOS - 位置更改时 SwiftUI 更新文本

iphone - iOS7全屏uiview..为什么状态栏消失了?

swift - 如何正确获取用户坐标?

ios - 如何在函数初始化后从函数中获取值?

ios - SpriteKit : One node with two physics body