I am developing an app for iPhone, it is using camera for scanning barcodes and taking pictures. When we don't have Camera access and the user enables Camera Access, the app crashes and the re-opens.
Can you folks help me to fix this?
Thanks in advance.
The first time you access the Camera the OS will automatically show the permission prompt. Whether the user allows or denies the prompt, your app will continue running. If the user at some point changes the Address Book, Calendars, Reminders, Camera, or Photos permissions, iOS will SIGKILL
the app. It takes this action to ensure that the app no longer has any previously authorized data in its possession. When the user moves from the Settings app back to the third-party app, it launches from scratch and now has the Denied authorization status. As a result of this behavior, I have two recommendations:
Detect when the permission is denied and present some UI that explaining that the user needs to toggle the Settings app permission. In iOS 8 you can take them directly to your app's entry with [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]
.
Implement some sort of state restoration so that when the app is terminated and relaunched it will return the user to the view/feature that was previously visible.
Source (requires developer account)
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