我正在开发一个iPhone应用程序,即使应用程序在后台,也需要不断更新位置 .
我所做的是:
-
设置位置更新的后台模式
-
set desiredAccuracy = kCLLocationAccuracyBestForNavigation
-
implement - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations;
-
调用[locationManager startUpdatingLocation]
当应用程序进入后台时,它将继续更新位置大约仅10分钟 . 然后,更新停止 .
有人知道为什么吗?如何在后台进行长时间的位置更新?
谢谢!
1 回答
来自Apple文档
似乎设置后台模式应该足够了 . 我让这个在我正在使用的应用程序中工作,我看到的唯一区别是我将
pausesLocationUpdatesAutomatically
设置为NO
.