I try to create my first app and i have the following issue. I use the Contact Framework and the ContactPicker to pick email addresses from contacts. In my first step i ask the user for authorization like.
// Check auth state for contacts
let store = CNContactStore()
switch CNContactStore.authorizationStatusForEntityType(.Contacts) {
case .Authorized:
self.authContacts = true
break
case .NotDetermined:
store.requestAccessForEntityType(.Contacts, completionHandler: { (succeeded, err) in
guard err == nil && succeeded else{
return
}
self.authContacts = true
})
break
default:
self.authContacts = false
break
}
Everything runs fine and smooth. But if i change the permission on xcode emulator to deny the access to my contacts, the app crashes. The "AppDelegate.swift" files open and the following line is marked with an red background.
class AppDelegate: UIResponder, UIApplicationDelegate {
But i do not see any error message on the console. So i want know, is this a normal issue? If a restart the xcode simulator everything works fine.
答案 0 :(得分:1)
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.