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)
})
}
}))
If you leave and use another app, the other app may use too much RAM for your phone to keep both apps open, so it has to shut one down, causing it to need to reload when you go back to it.
Apps are only allowed to stay open in the background for a few minutes (this saves RAM), so if the developer doesn't have the app save where you were last, the app will reset to its start page. So no, you can't do anything about this. This is why you don't really need to close your apps in the app switcher.
Tap on Settings on your iPhone or iPad > General > Background App Refresh > toggle Background App Refresh to Off.
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
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