2

In my app I have a rare bug that stops showing the userlocation. If I tone the app down and just have the map, and set everything up in the viewDidLoad, and at the end do the typical:

myMapView.showsUserLocation = YES;

everything works great 99% of the time. It always works when the App is starting from scratch, but like 1 time out of 100, when resuming from the background, the userlocation doesn't show. And even if I make a button to turn showsUserLocation back on, it still won't show (and upon doing NSLog's the property shows that it is set to YES in the MKMapView). If I kill the program, and start it again, it works fine again.

Everything is being done in the main thread as well.

Anyone encounter anything like this?

Jason
  • 43
  • 8
  • I've seen this as well. I assume that this happens when gps does not send location updates to the app, and thus MKMapView does not update the user location - if it happens not to be currently visible, it will not be drawn. But I might as well be completely wrong and it is a bug. – Axel Apr 15 '11 at 17:28
  • The strange thing is I can background the app a bunch of times, but when it comes back to the foreground, once it messes up and doesn't show, it will NEVER show. Until I close the app and restart it anyways. – Jason Apr 15 '11 at 21:22
  • It sounds like your mapview's delegate is being cleared. Probably a memory event was triggered, and the delegate isn't being set properly on resume. – Michael Kernahan Apr 09 '13 at 15:27

1 Answers1

0

you can refer this image for fetch location in backgroud Mode

enter image description here

Vidhi Patel
  • 603
  • 5
  • 10