位置更新在iPhone 5(iOS 7)中不起作用,但在模拟器中工作

时间:2013-11-30 18:11:04

标签: ios iphone ios7 cllocationmanager

我的iPhone背景位置服务有问题。所以,我决定在我的设备上测试前台服务。最好的是,即使它不起作用。

- (IBAction) btnPressed
 {
     [self startStandardUpdates]
 }
- (void)startStandardUpdates
{

    if (nil == self.manager) {
        [CLLocationManager locationServicesEnabled];
        self.manager = [[CLLocationManager alloc] init];
        self.manager.delegate = self;
        self.manager.desiredAccuracy = kCLLocationAccuracyBest;
        self.manager.pausesLocationUpdatesAutomatically = NO;
        [self.manager startUpdatingLocation];
   }
}

- (void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager
{
    NSLog(@"Paused");
}

- (void)locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager
{
   NSLog(@"Resumed");
}

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
    NSLog(@"Error : %@", error);
}

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
    NSLog(@"Locations : %@",locations);

}

显示三次更新后,它会停止。并且永远不会调用- (void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager,因为“Paused”永远不会被注销。

1 个答案:

答案 0 :(得分:2)

设备是否静止不动?如果是这样,我认为一旦确定设备未超出指定半径,Core Location将根据您所需的精度停止触发。没必要。