0

I have a class which contains an instance of MKMapView

@property(nonatomic, weak) IBOutlet MKMapView *ibMapView;

While I do also use a singleton instance of CLLocationManager in other places in the project, I've found that this map view is responsible for the "Location" icon showing on the iPhone status bar.

Specifically, this code is to blame:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    // If I comment out this line below, the "Location" status icon never shows, as expected 
    self.ibMapView.showsUserLocation = YES;

    // ...other magical stuff happens here, not related to map view
}

I've tried setting showsUserLocation to NO like this

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.ibMapView.showsUserLocation = NO;

    // I also have tried logging to make sure showUserLocation is set to NO- returns "NO" as expected
    DebugLog(@"Show User Location: %@", self.ibMapView.showsUserLocation ? @"YES" : @"NO");

    // ...other stuff happens here, not related to map view...
}

However, the location status icon still shows... it never turns off, even after an hour has passed...

How can I get the location status icon caused by setting showUserLocation to YES on an MKMapView instance to go away?

JRG-Developer
  • 12,454
  • 8
  • 55
  • 81
  • does '- (void)viewWillDisappear:(BOOL)animated' getting called? have you tried any logs inside '- (void)viewWillDisappear:(BOOL)animated' – rakeshNS Feb 26 '13 at 06:49
  • Thanks for the response. Yes, `viewWillDisappear:` is called, as verified by putting logs inside it (see updated question). – JRG-Developer Feb 26 '13 at 06:55

1 Answers1

0

As it turns out, this is a bug in Apple's frameworks somewhere...

See this question and the selected answer for a solution:

Location indicator persists on status bar after stopUpdatingLocation is called, but only for old Bundle Identifier

Essentially, if you Reset Location & Privacy (Settings -> General -> Reset -> Reset Location & Privacy), this fixes the issue (as long as you also make sure that you set showsUserLocation to NO once you're done it with).

Community
  • 1
  • 1
JRG-Developer
  • 12,454
  • 8
  • 55
  • 81