This code use for accessing address book
ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL);
// Check address book permission is given or not
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined)
{
ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error)
{
//the address book permission is given
//do your code for address book
});
}
else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized)
{
//if you have already permission for address book
//do your code for address book
}
else {
// The user has previously denied access
// Send an alert telling user to change privacy setting in settings app
}
No comments:
Post a Comment