6

I have an app which uses, the Event Kit to sync some events with the iOS calendar. This works fine with one exception. If the app is in the background/suspended and the privacy setting for the calendar are changed (settings > privacy > calendar > my app ) the app crashes. This happens even if the classes which use the EkEventKit haven't been used yet

I have only run it in the iOS simulator so far but Xcode dose not give much useful information only that the app is sent SIGKILL.

Could someone suggest what could be causing this or how I could find out

mark
  • 147
  • 10
  • Oops, SOF converted my answer to a comment, I'll add my answer below – jhilgert00 Nov 19 '13 at 15:36
  • possible duplicate of [App crashed in iOS 6 when user changes Contacts access permissions](http://stackoverflow.com/questions/12810638/app-crashed-in-ios-6-when-user-changes-contacts-access-permissions). It's the same issue even though it talks about permissions for contacts. – rmaddy Nov 19 '13 at 17:03

1 Answers1

13

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)

jhilgert00
  • 5,479
  • 2
  • 38
  • 54
  • So this is the expected behaviour? That means I can remove some of the permission checks I put into appDidEnterForeground and other places – mark Nov 20 '13 at 15:09
  • 1
    Yes, you still need at least one permission check so you can disable the UI and tell the user how to re-enable it. I wouldn't imagine you'd need more than 1 check in place since the app gets terminated. The check can happen when the app loads. – jhilgert00 Nov 20 '13 at 16:02
  • 2
    Yes - if you run the app on the device, independent of Xcode device debugging or simulator, you'll see that the app just restarts, invisibly to the user. Make sure your app handles a restart well, and it'll be golden! – leanne May 04 '14 at 22:24
  • Thanks for your answer! Same behaviour on iOS 9.1, Xcode 7.1.1. – Alex Dec 08 '15 at 09:54