abaddressbook - Swift playground - Address book - access denied -
is possible test code relating address book api in swifts playground? don't know how give xcode access address book.
this code:
let authorizationstatus = abaddressbookgetauthorizationstatus() if (authorizationstatus == abauthorizationstatus.notdetermined) { println("requesting access...") var emptydictionary: cfdictionaryref? var addressbook = !abaddressbookcreatewithoptions(emptydictionary, nil) abaddressbookrequestaccesswithcompletion(addressbook,{success, error in if success { // } else { println("unable request access") } }) } else if (authorizationstatus == abauthorizationstatus.denied || authorizationstatus == abauthorizationstatus.restricted) { println("access denied") } else if (authorizationstatus == abauthorizationstatus.authorized) { println("access granted") // else }
it prints me access denied -.-
Comments
Post a Comment