I need to ask user to enable Location Services if disabled. I have created an Alert which asks user if he wants to enable Location. I user clicks Ok I want to open Location Services page on iPhone as seen below:
I am trying 'openSettingsURLString' but it opens App settings instead of Location Services page, this is the code:
let url = URL(string: UIApplication.openSettingsURLString)
let settingsAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default) {
(UIAlertAction) in UIApplication.shared.open(url!, options: [:], completionHandler: nil)
self.dismiss(animated: true, completion: nil)
}
alertController.addAction(cancelAction)
alertController.addAction(settingsAction)
self.present(alertController, animated: true, completion: nil)
I believe this is not possible, you can only navigate to the settings of the app itself; Apple expects the user themself to navigate to location services. . I would recommend giving the user instructions on how to navigate to location services as an alternative such as some screenshots and the path they should take.