I have a problem with startMonitoringSignificantLocationChanges. If I call this method for my locationManager the locationManager:didUpdateLocations:
Method is called exactly once. Now if I start a Drive in Simulator (as described here - Debug -> Location -> Freeway Drive) it is not called anymore. By Apple it is specified that it should be called every 500m or even every 5 to 15 Minutes. And I waited and waited and waited with no success.
Here is the little code and I made also a Github minimal example. Of course error method is also never called. It is not tested on a real Device in car because I thought it should work in Simulator first. What am I missing here?
- (void)viewDidLoad {
[super viewDidLoad];
if(self.locationManager == nil){
self.locationManager = [[CLLocationManager alloc] init];
}
// Set the delegate
self.locationManager.delegate = self;
[self.locationManager requestAlwaysAuthorization];
[self.locationManager startMonitoringSignificantLocationChanges];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations{
CLLocation *currentLoc = [locations lastObject];
NSLog(@"New Location: %f/%f, Locations: %lu", currentLoc.coordinate.latitude, currentLoc.coordinate.longitude,(unsigned long)[locations count]);
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{
NSLog(@"Loc Error: %@", [error userInfo]);
}