我正在设置以下内容,我假设它不会根据我的参数调用“didUpdateLocations”,但它每秒调用它大约 3 次?
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager setActivityType:CLActivityTypeAutomotiveNavigation];
[self.locationManager allowDeferredLocationUpdatesUntilTraveled:15 timeout:3000.0];
设置“allowDeferredLocationUpdatesUntilTraveled”后它仍然每秒调用它大约 3 次?
最佳答案
您可以解决您想要的部分结果 - 仅当它们行进超过 15m 时才更新 -
self.locationManager.distanceFilter = 15;
来自文档:“在生成更新事件之前设备必须水平移动的最小距离(以米为单位)。”
刚刚在我的 iOS7/8 应用程序中使用过,在前台似乎运行良好。
对于触发之间的时间,建议使用CLLocation时间戳。
关于ios - 位置管理器 :didUpdateLocations being called non stop when allowDeferredLocationUpdatesUntilTraveled set?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24436870/