【发布时间】: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