If the map is visible and has showUserLocation installed on YES, it continues to update in the background.
You need to undo this when the view disappears or when the application goes into the background. The best way would probably be to register your viewController to receive notifications for UIApplicationDidEnterBackgroundNotification and UIApplicationDidBecomeActiveNotification .
- (void)viewDidLoad{ [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appToBackground) name:UIApplicationDidEnterBackgroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appReturnsActive) name:UIApplicationDidBecomeActiveNotification object:nil]; }
Then, in the method called by this notification, change the map display properties relative to userLocation :
- (void)appToBackground{ [mapview setShowsUserLocation:NO]; }
AND
- (void)appReturnsActive{ [mapview setShowsUserLocation:YES]; }
Make sure that these methods are actually called by setting a breakpoint there and returning to the main screen.
Cyril godefroy
source share