如果我startUpdatingLocation在startMonitoringSignificantLocationChanges跑步的时候打电话怎么办?significantLocationChange监控是否会停止?如果我然后stopUpdatingLocation将significantLocationChange监控继续或重启?
我找不到涵盖这两种监控位置方式之间相互作用的文档.
测试设备:iPhone 5(iOS 7)
我有一个使用RegionMonitoring和的应用程序updateLocation.如果输入某个区域,didEnterRegion则按预期调用.然后我打电话startUpdatingLocation.但是该方法didUpdateToLocation仅被调用10-20次,而它应该更新位置直到计时器触发.
相关代码:
CLLocationManager *_locationManager;
NSTimer *_timer;
-(void)initLocationManager
{
_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
[_locationManager setActivityType:CLActivityTypeOther];
[_locationManager setDesiredAccuracy:kCLLocationAccuracyBestForNavigation];
[_locationManager setPausesLocationUpdatesAutomatically:NO];
[_locationManager setDistanceFilter:kCLDistanceFilterNone];
}
//Did Enter Region, called as expected:
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
[_locationManager startUpdatingLocation];
_timer = [NSTimer scheduledTimerWithTimeInterval:300.0f target:self selector:@selector(scheduleMethod:) userInfo:nil repeats:NO];
}
//Timer Fire Method:
- (void) scheduleMethod:(NSTimer*)timer
{
[Utils writeToLog:@"Timer-Stop"];
[_locationManager stopUpdatingLocation];
}
//This Method only called 10-20 Times (in …Run Code Online (Sandbox Code Playgroud)