Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top