startMonitoringSignificantLocationChanges缺乏准确性

Nat*_*lls 3 objective-c core-location ios

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

我目前正在使用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
Run Code Online (Sandbox Code Playgroud)

以上都是在没有我将设备移动一英寸的情况下发生的.我的预感是startMonitoringSignificantLocationChanges不够准确,无法完成这个要求.是这样的吗?或者我可能会忽视某些事情?

对于任何反馈,我们都表示感谢.我没有发布任何代码,但它都是非常基本的CLLocationManager东西.如果需要更多信息或代码片段,请与我们联系.

提前致谢!

dus*_*uff 5

从该CLLocationManager文档:

此接口[ 例如,startMonitoringSignificantLocationChanges ]仅在检测到设备关联的单元塔的更改时才会发送新事件,从而减少更新频率并显着降低功耗.

因此,不太可能startMonitoringSignificantLocationChanges用于检查您正在寻找的准确度水平的位置 - 细胞塔很少能够很好地定位您.您可能想尝试使用startMonitoringForRegion:desiredAccuracy:; 它也可以在后台运行,并且会为你做很多肮脏的测试.