Rutger Bresjer
Rutger Bresjer

Reputation: 441

Crash when Calendar permission changes outside iOS app

I'm integrating EventKit in an iOS app, but I am experiencing a weird crash which I'm not able to debug.

In the app I've got a UISwitch which enables Calendar-related functionality. When the switch is switched on for the first time, the app requests Calendar authorization, which works fine. If you then switch to the Settings app (with the app still running in the background) and disable Calendar authorization, the app crashes on the background with a Message from debugger: Terminated due to signal 9 without any further information. This happens on both the simulator (iPhone X, iOS 11.2; iPhone 6s, iOS 11.0.1) and my phone (iPhone X, iOS 11.2.6).

It also happens the other way around: when authorization is not given (.denied) I redirect the user to the Settings app. When the user then switches on the Calendar authorization, the app crashes with the same message.

Example code: https://gist.github.com/rbresjer/4e971c0650e63a53bd81056e962c121b

My project contains a valid Info.plist file with the relevant privacy description for calendar usage.

Any ideas?

Upvotes: 4

Views: 800

Answers (1)

T. Pasichnyk
T. Pasichnyk

Reputation: 732

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

Upvotes: 2

Related Questions