0

我正在尝试在我的 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”属性没有出现。这是为什么?

有没有人成功实现过这个功能?如果是这样,你能分享你的实现吗?谢谢你。

4

1 回答 1

0

在您要复制的示例代码中,您deferringUpdates必须在对象上定义一个属性CLLocationManagerDelegate。它不是框架定义或提供的东西。该示例代码不是您可以放入应用程序的完整实现。

于 2013-11-19T00:29:21.433 回答