0

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]);
}
Community
  • 1
  • 1
Moritz Pfeiffer
  • 447
  • 1
  • 7
  • 23

1 Answers1

0

Okay I just downloaded my own minimal Project from Github and tried it with iPhone 5S Simulator. There it works. Before I had only tried it with 6S and there it didn't work. Now will try on device 6(S) and hopefully will work there as well..

But maybe will help somebody in the near future :)

Moritz Pfeiffer
  • 447
  • 1
  • 7
  • 23