views:

333

answers:

2

In the settings -> general, there is a switch to turn on/off the location services. In the Maps app, when location services is off, if the user click on the find me button, it pops up an alert and asks the user to turn on location services in the settings. It then exits the app and launch the settings app. How can I do that programmatically in my app?

A: 

I didn't finish reading the whole question!

However, see: http://stackoverflow.com/questions/736047/programmatically-opening-the-settings-app-iphone

(Original reply: The Settings app doesn't seem to have a custom URL scheme, so it appears that the answer is "no".)

Wevah
hm, I read that post before, but I'm not sure about which version of API they are refering to. Also, every app that uses google map has the same alert when location services is off. Or is that pop up automatically?
Brian
I believe that's part of MapKit.
Wevah
A: 

If you just use location services by [CLLocationManager startUpdatingLocation] it will automatically pop up the alert you describe if Location Services are disabled.

However, there's no way to force showing the alert when your specific app has been rejected from using location services by the user (in iOS 4 by disabling your app in the location settings, in iOS 3 by denying the CoreLocation request at the first 2 starts of the app). You only receive the kCLErrorDenied error in -locationManager:didFailWithError:.

Maps.app does show the alert with a Settings button in this case but it looks like they're using a private API for that.

Ortwin Gentz