I need to prompt users to change camera permissions for my app via a UIAlertController. The alert has the following action:
alert.addAction(UIAlertAction(title: "Open Settings", style: .default, handler: { (action) -> Void in
guard let settingsUrl = URL(string: UIApplicationOpenSettingsURLString) else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
DispatchQueue.main.async(execute: {
UIApplication.shared.openURL(settingsUrl)
})
}
}))
This does work in so far as it opens the settings, but if the user changes the Camera permission, the app crashes in the background with Message from debugger: Terminated due to signal 9
.
They can now open up the app and the permission is correct, but they need to start from the beginning. Does anyone know how to solve this?