5

Swift (iOS 8 / iOS 9): App crash when I change permission AddressBook in Settings on real device

Error when permission change in Settings Code Code

JAL
  • 39,073
  • 22
  • 153
  • 285
Sergey Krasiuk
  • 196
  • 2
  • 9
  • 1
    please put here some code for fetch contact details – Ilesh P Dec 21 '15 at 11:48
  • This is normal behavior. Please see other identical questions : http://stackoverflow.com/questions/12522574/toggling-privacy-settings-will-kill-the-app – Baptiste Truchot Dec 21 '15 at 11:58
  • @ilesh I`m not fetch contacts, I only get access to AddressBook. When app working I switch access to AddressBook in device Settings. When permission switched - app crash. Thats all. – Sergey Krasiuk Dec 21 '15 at 11:59
  • @user3375798 In iOS7 (Objective-C) I don`t have this error – Sergey Krasiuk Dec 21 '15 at 12:01
  • App also quits in iOS7. Note, though: if running the app on the device normally - NOT in Xcode debugging - the app will automatically be relaunched after the permissions have changed. The user won't see that a crash occurred (assuming, of course, that the app handles everything properly on restart). – Baptiste Truchot Dec 21 '15 at 12:03
  • @user3375798 Ok, I understood. Thank you. – Sergey Krasiuk Dec 21 '15 at 12:10

1 Answers1

34

Your app is not crashing its just forced to restart by iOS with new privacy settings. So when you change the privacy policy, app will be killed if its attached to debugger else it will restart or relaunch.

Note : If the user at some point changes the Address Book, Calendars, Reminders, Camera, or Photos permissions, iOS will SIGKILL the app. (It's not crash it's default behaviour of iOS)

iPatel
  • 41,165
  • 13
  • 109
  • 131
Maulik
  • 19,108
  • 14
  • 80
  • 136