I have a view that says map view. I used CLLocationManager to get the current location and show on the map. Then, when the view is closed, I do the following
_mapView.delegate = nil; _mapView = nil; [_locationManager stopUpdatingLocation]; _locationManager.delegate = nil; _locationManager = nil;
However, the location service indicator (GPS) in the status bar is still unchanged. And when the application goes into the background and then back to the fore, it will wait until the indicator appears on the status bar before it is active.
Is there a reason the indicator still exists?
EDIT - the following: CLLocationManager is initialized and launched
if (_locationManager == nil) { _locationManager = [[CLLocationManager alloc] init]; _locationManager.delegate = self; _locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; _locationManager.distanceFilter = kCLDistanceFilterNone; [_locationManager startUpdatingLocation]; }
and that's how I stopped him
if (_locationManager != nil) { [_locationManager stopUpdatingLocation]; _locationManager.delegate = nil; _locationManager = nil; }
source share