5

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;
    }
tom
  • 14,273
  • 19
  • 65
  • 124

2 Answers2

2

As was explained at WWDC by the location engineers, the icon remains in the top right corner for a specific amount of time depending on which service was last used. I believe that once you stop using location, [locationManager stopUpdatingLocation], the timer begins before the icon will disappear. Longer for some services. They didn't go into detail as to how long those timers are. I do know they are going to get longer in iOS 6.

Once you stop monitoring location, just wait it out (30-60 seconds) and see if the icon drops off. It should assuming you have everything stopped. Hope this helps.

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
1

I had a similar problem and found the answer here:

What determines the presence of the iPhone Location Services icon in the status bar?

The solution in my case (in development) was to reset location warnings (Settings > General > Reset > Reset Location Warnings)

Community
  • 1
  • 1
Alan Samet
  • 1,118
  • 2
  • 15
  • 18