App Crashes in Background While Changing Permission - Swift

App crashes in background while changing permission - swift

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)

App is forced to restart by iOS with new privacy settings

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

Crash when Calendar permission changes outside iOS app

It is an expected behaviour for iOS, when you change its permissions in settings. If the app was opened, the system will send "Message from debugger: Terminated due to signal 9" and the user has to start app manually again.

And I believe there are many similar questions on SO.
Like this: App crashes in background while changing permission - swift

Watch App get killed while allowing/disallowing camera permission on iPhone App

Your app is not crashing its just forced to restart by WatchOS with new privacy settings. So when you change the any permission in iPhone then it means privacy policy changed, so app will be killed if its attached to debugger else it will relaunch. its happing on both Apple Watch and iPhone. if you change the permission in Apple Watch iOS app will restart. if you change the permission in iOS app Apple Watch app will be restart.

Also, Not only camera permission If the user at some point changes the Address Book, Calendars, Reminders, Camera, or Photos permissions, WatchOS app will SIGKILL the app when change App permission in iPhone. (it's default behaviour of iOS and WatchOS)

Please refer the below links

App killed by SIGKILL when changing privacy settings ,
https://developer.apple.com/forums/thread/64740,
App crashes in background while changing permission - swift,
App crashed in iOS 6 when user changes Contacts access permissions

App crashed in iOS 6 when user changes Contacts access permissions

I've seen this in my own app. And I've seen others report this as well. I'm pretty sure this is deliberate behavior. The OS kills any background apps that react to changes in privacy permissions. Apple appears to have taken a sledgehammer approach to this. It's not a crash (though it may appear so when running in the debugger). Apps get terminated for various other reasons. Add this to the list of reasons. This gives us more reason to do a good job restoring app state upon a full restart of our apps.

Note that this behavior applies to all of the various privacy settings such as contacts, photos, microphone, calendar, and camera.

App crash after changing permission

If you change permissions from outside the app (for example at the device settings, or at the simulator) - the app will crash.
This is the normal behaviour.

iOS 7 app crashes when changing calendar privacy

It's actually not a crash, although it appears that way when you are testing on your device through xCode. If you unplug your device and do some further testing, you'll notice that when you return to your app after changing the privacy setting, the app is killed as soon as the privacy setting has changed, and it relaunches when you return to it.

I'm not sure about simulator, but I'm guessing it's the same. (The app I'm developing uses Calendar, so I'm forced to do all of my testing on the device itself)

App is crashing after trying to show a UIAlert if the user hasn't granted permission for notifications

Consider the following code:

DispatchQueue.main.async {
self.present(permissionNotGrantedAlert, animated: true)
}


Related Topics



Leave a reply



Submit