locationManager:didUpdateLocations: always be called several times
cllocationmanager, ios, iphone
Solution
Probably it depends about the accuracy you set to the locationManager. You have 3 kinds o localization Cell Radio, WiFi Map, GPS. If you set best as accuracy the location manager will continue to check you position, if the location with better accuracy is out of the range of the distance filter the delegate method will be called again.
Problem
I start updating current location when the view did appear, and stop updating location whenever `locationManager:didUpdateLocations:` is called. But why the `locationManager:didUpdateLocations:` always be called several times? What have I missed? ``` #import "ViewController.h" @interface ViewController (){ CLLocationManager *locationManager; // location manager for current location } @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self startUpdatingCurrentLocation]; } - (void)startUpdatingCurrentLocation { if (!locationManager) { locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; locationManager.distanceFilter = 10.0f; // we don't need to be any more accurate than 10m } [locationManager startUpdatingLocation]; } -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{ [locationManager stopUpdatingLocation]; } @end ```