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?
Your app is not crashing its just forced to restart by iOS with new privacy settings. So when you change the camera permission then it means privacy policy changed, so app will be killed if its attached to debugger else it will relaunch.
Also, Not only camera permission If the user at some point changes the Address Book, Calendars, Reminders, Camera, or Photos permissions, iOS will SIGKILL the app. (it's default behaviour of iOS)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With