When a user has location services turned off, I want to prompt to turn them on with a UIAlertController. One of the options in the Alert Controller should take them directly to location services (for the OS, not the app). Right now, I've gotten as far as being able to send the user to permissions for my specific app, but not for the overall OS location settings. Is there a way to send the user directly to the OS Location settings from the UIAlertController?
Here is the current code (located in viewDidAppear):
if (CLLocationManager.locationServicesEnabled())
{
daMap.delegate = self
daMap.mapType = MKMapType.Satellite
daMap.showsUserLocation = true
// do some other things...
} else {
let alertController = UIAlertController(
title: "We Can't Get Your Location",
message: "Turn on location services on your device.",
preferredStyle: .Alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
alertController.addAction(cancelAction)
let openAction = UIAlertAction(title: "Location Settings", style: .Default) { (action) in
if let url = NSURL(string:UIApplicationOpenSettingsURLString) {
UIApplication.sharedApplication().openURL(url)
}
}
alertController.addAction(openAction)
self.presentViewController(alertController, animated: true, completion: nil)
}