Skip to content

Instantly share code, notes, and snippets.

@janakaaleph
Created September 6, 2020 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janakaaleph/d7743ca623ce69d903c44f7eac321be4 to your computer and use it in GitHub Desktop.
Save janakaaleph/d7743ca623ce69d903c44f7eac321be4 to your computer and use it in GitHub Desktop.
if locationManager.accuracyAuthorization == .reducedAccuracy {
let alertController = UIAlertController(title: "Alert", message: "Need your exact location to start navigation", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default) { (_) in
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
// Successfully navigated to settings
})
}
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
alertController.addAction(okAction)
alertController.addAction(cancelAction)
self.present(alertController, animated: true, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment