Helle there,
I was having problem with background location services both testing on simulator and devices. locationManagerDidPauseLocationUpdates is never called as "Paused" is never logged out. locationManagerDidResumeLocationUpdates is never called as "Resume" is never logged out.
Below is my sample code:
- (void)viewDidLoad {
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
if ([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[locationManager requestAlwaysAuthorization];
}
[locationManager setActivityType:CLActivityTypeFitness];
[locationManager setPausesLocationUpdatesAutomatically:YES];
locationManager.distanceFilter = kCLLocationAccuracyNearestTenMeters;
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
[locationManager startUpdatingLocation];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations{
NSLog(@"currentLocation");
}
-(void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager{
NSLog(@"Paused");
}
-(void)locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager{
NSLog(@"Resume");
}