pausesLocationUpdates在iOS 6中自动无法按预期工作

Roh*_*yap 5 cllocationmanager ios6

我想实现一个功能,我使用GPS进行更新,当用户不移动时,我希望暂停GPS更新.根据" 与位置服务保持同步 "视频,我这样做了:

 //Configure Location Manager
 self.theLocationManager = [[CLLocationManager alloc]init];
[self.theLocationManager setDelegate:self];
[self.theLocationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[self.theLocationManager setActivityType:CLActivityTypeFitness];

 NSLog(@"Activity Type Set: CLActivityTypeFitness");

[self.theLocationManager setPausesLocationUpdatesAutomatically:YES];
[self.theLocationManager startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)

代表:

- (void)locationManager:(CLLocationManager *)manager
    didUpdateLocations:(NSArray *)locations
{
    NSLog(@"Started location Updates");
}


- (void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager
{
    NSLog(@"Pausing location Updates");
}

- (void)locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager
{
    NSLog(@"Resuming location Updates");

    UIAlertView *pop = [[UIAlertView alloc]initWithTitle:@"Info" message:@"Location    Updates resumed" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [pop show];
    [pop release];
}
Run Code Online (Sandbox Code Playgroud)

我没有得到所需的行为,当设备空闲时,代理人"didPause .."和"didResume ..."甚至没有被调用.

理想情况下,GPS更新必须停止和恢复,具体取决于设备的状态和CLActivityType,但不是这里的情况.

任何人都可以帮助我,我做错了什么?

提前致谢.

Lau*_*ent 2

如果您让设备在同一位置停留大约 15 分钟,就会出现暂停。