Check if an instance of CLLocationManager isUpdatingLocation
cllocationmanager, ios, objective-c
Solution
subclass your CLLocationManager and add a BOOL that is set to yes when your delegate method gets called...
You can also simply tell your location manager to stop within the delegate method
Problem
I need to know if an instance of `CLLocationManager` (in this case called `gps`) is updating location calling the proper method ``` - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation ``` In my case the complete method is: ``` - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //NSLog(@"didUpdateToLocation: %@", newLocation); currentLocation = newLocation; if (currentLocation != nil) { longitude.text = [NSString stringWithFormat:@"%.3f", currentLocation.coordinate.longitude]; latitude.text = [NSString stringWithFormat:@"%.3f", currentLocation.coordinate.latitude]; } address.text = NULL; [activityIndicator setHidden:NO]; [activityIndicator startAnimating]; NSLog(@"Resolving the Address"); [geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) { //NSLog(@"Found placemarks: %@, error: %@", placemarks, error); if (error == nil && [placemarks count] > 0) { placemark = [placemarks lastObject]; [address sizeToFit]; address.text = [NSString stringWithFormat:@"%@, %@\n%@ %@\n%@", [self sanitizedDescription:placemark.thoroughfare], [self sanitizedDescription:placemark.subThoroughfare], [self sanitizedDescription:placemark.postalCode], [self sanitizedDescription:placemark.locality], [self sanitizedDescription:placemark.country]]; if (address.text != NULL) { gpsTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:gps selector:@selector(startUpdatingLocation) userInfo:nil repeats:NO]; [address sizeToFit]; [gps stopUpdatingLocation]; } } else { NSLog(@"%@", error.debugDescription); } } ]; } ``` How can I do? Thanks in advance :)