I have an MKMapView in my app and have a button that turns on showsUserLocation for the map, while the map is finding the location I display a spinner so the user knows its working. I know when to stop the spinner by adding NSKeyValueObserver to the map's userLocation property. However if the user has Location Services disabled then the spinner just keeps on going forever but nothing happens, is there any way to know when location services are disabled while using an MKMapView?
Use locationServicesEnabled, a boolean property of a CLLocationManager.
The MapKit support for automatically showing the user's location is pretty poor. The app I'm writing shows the user's location, but I use CLLocationManager directly and add my own annotation to the map.
mythogen,
I'm beginning to think I am going to have to do the same thing.
My problem is that turning on showsUserLocation causes the MKMapView to turn on the GPS and request constant updates.
What I really want is to display a blue dot for the last known user location, then query core location for the location myself, on regular intervals. That way my app could reduce the power requirements.
How far did you go in adding your own annotation? The standard annotation you get with showsUserLocation has some nice features like the pulsating circle, and the "ring of confusion" to show the error radius for the GPS results based on the accuracy reading.
I wish Apple would allow us to decouple displaying this annotation from updating the GPS location.
Duncan C
Note that locationServicesEnabled is new in 4.0, so won't work if your deployment target is lower.
Edit: Nevermind -- the class method [CLLocationManager locationServicesEnabled] is new in 4.0. But there is a now deprecated instance property .locationServicesEnabled for earlier SDK's.