我正在尝试在我的 iOS 应用程序中实现延迟位置更新功能。我了解此功能可显着降低使用 GPS 的位置感知应用程序的功耗。Apple 的文档以以下代码为例:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
[self.run addLocations:locations];
if (!self.deferringUpdates) {
CLLocationDistance distance = self.hike.goal - self.hike.distance;
NSTimeInterval time = [self.nextAudible timeIntervalSinceNow];
[locationManager allowDeferredLocationUpdatesUntilTraveled:distance
timeout:time];
self.deferringUpdates = YES;
}
}
但是,当我开始输入时if (!self.d
……“deferringUpdates”属性没有出现。这是为什么?
有没有人成功实现过这个功能?如果是这样,你能分享你的实现吗?谢谢你。