Skip to content

Instantly share code, notes, and snippets.

@TheSwiftyCoder
Created January 26, 2017 12:44
Show Gist options
  • Save TheSwiftyCoder/4e4d56444c89c1020facf13c5b477a21 to your computer and use it in GitHub Desktop.
Save TheSwiftyCoder/4e4d56444c89c1020facf13c5b477a21 to your computer and use it in GitHub Desktop.
Unable to deallocate send right solution
fileprivate func createSettingsAlert(_ title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Settings", style: UIAlertActionStyle.default, handler: { (UIAlertAction) in
// Use the DispatchQueue.main.async {} block to handle any would be background thread methods.
DispatchQueue.main.async {
if let appSettings = URL(string: UIApplicationOpenSettingsURLString) {
UIApplication.shared.open(appSettings, options: [:], completionHandler: nil)
}
}
}))
self.present(alert, animated: true, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment