相关疑难解决方法(0)

startMonitoringSignificantLocationChanges和startUpdatingLocation如何相互影响?

如果我startUpdatingLocationstartMonitoringSignificantLocationChanges跑步的时候打电话怎么办?significantLocationChange监控是否会停止?如果我然后stopUpdatingLocation将significantLocationChange监控继续或重启?

我找不到涵盖这两种监控位置方式之间相互作用的文档.

core-location cllocationmanager ios ios5

16
推荐指数
3
解决办法
3353
查看次数

在Background中的StartUpdateLocations,didUpdatingToLocation仅调用10-20次

测试设备: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)

iphone objective-c core-location cllocationmanager ios

8
推荐指数
1
解决办法
3696
查看次数