I have a view with has a subview of map view. I used CLLocationManager to get the current location and show on the map. Then when the view is about to be closed, I do the following
_mapView.delegate = nil;
_mapView = nil;
[_locationManager stopUpdatingLocation];
_locationManager.delegate = nil;
_locationManager = nil;
But the location service (GPS) indicator on the status bar still stay without disappeared. And when the app goes into background and then back to foreground, it'll wait the the indicator to show up on status bar before being active.
Is there any reason why the indicator is still there?
EDIT - the following is how the CLLocationManager is initialized and started
if (_locationManager == nil) {
_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
_locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
_locationManager.distanceFilter = kCLDistanceFilterNone;
[_locationManager startUpdatingLocation];
}
and the following is how I stopped it
if (_locationManager != nil) {
[_locationManager stopUpdatingLocation];
_locationManager.delegate = nil;
_locationManager = nil;
}