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 fix this?
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 is not a problem of your application. Its just the way apple designed iOS. iOS will terminate the application when user change certain permissions of it.
Actually you will get a SIGKILL message but no Crash log when toggling settings. In this situation even applicationWillTerminate
not get called!
So the answer is you can't fix it.
Look at page 24 of this slide