【问题标题】:startMonitoringSignificantLocationChanges Lack of AccuracystartMonitoringSignificantLocationChanges 缺乏准确性
【发布时间】:2012-01-07 14:36:54
【问题描述】:

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

我目前正在使用 CLLocationManager 的 startUpdatingLocation 将初始 GPS 位置精确到 100 米以内。这很好用。

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

现在,我遇到的问题是使用 startMonitoringSignificantLocationChanges 时返回的位置的准确性。如果我只是让我的手机放在我的桌子上,等待 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 东西。如果需要更多信息或代码 sn-ps,请告诉我。

提前致谢!

【问题讨论】:

    标签: objective-c ios core-location


    【解决方案1】:

    来自the CLLocationManager docs

    此接口 [例如 startMonitoringSignificantLocationChanges] 仅在检测到设备相关蜂窝塔发生变化时才提供新事件,从而降低更新频率并显着降低功耗。

    因此,startMonitoringSignificantLocationChanges 不太可能用于检查您正在寻找的准确度级别的位置 - 很少有手机信号塔可以很好地定位您。您可能想尝试改用startMonitoringForRegion:desiredAccuracy:;它也可以在后台运行,并且会为您完成大量对该区域进行命中测试的繁琐工作。

    【讨论】:

    • 谢谢 - 我知道手机信号塔的变化会触发带有 startMonitoringSignificantLocationChanges 的事件,但并不是说使用蜂窝电话而不是 GPS 来检测位置。是否记录了 GPS 不与 startMonitoringSignificantLocationChanges 一起使用?
    • 另一个小评论 - 如果手机信号塔的变化触发了事件,为什么手机从不移动时会发生这种情况?
    • 没有明确说明,但我看不出startMonitoringSignificantLocationChanges 使用 GPS 的任何理由。 sMSLC 的重点是省电;每次更改位置时自动启动 GPS 并等待修复会消耗不必要的电量。关于手机不动 - 手机可以并且会自发切换塔,可能是因为信号强度的变化。
    猜你喜欢
    • 1970-01-01
    • 2021-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-06
    相关资源
    最近更新 更多