0

I am trying to add contact in device contact list. The code is working fine in iOS7 but not working in iOS8. I am getting "didAdd 0" in ios8

---
---
---     
ABAddressBookAddRecord(iPhoneAddressBook, newPerson, nil);
        BOOL didAdd = ABAddressBookSave(iPhoneAddressBook, nil);

        if(didAdd){

            NSLog(@"didAdd %d",didAdd);
        }else{
            NSLog(@"didAdd %d",didAdd);
        }
Ranjit Chandel
  • 1,479
  • 6
  • 19
  • 33
  • add 'CFErrorRef error;' pass '&error' instead of 'nil' then check the value – Seryozha Apr 11 '15 at 13:15
  • Yeah I got this error - The operation couldn’t be completed. (ABAddressBookErrorDomain error 1 – Ranjit Chandel Apr 11 '15 at 13:44
  • Is that error message for `ABAddressBookAddRecord` or `ABAddressBookSave`? You should retrieve the error objects for both. – Rob Apr 11 '15 at 13:53
  • yeah finally I got issue, I follow this link http://stackoverflow.com/a/12648938/480415 (address book must be granted before access it programmatically) – Ranjit Chandel Apr 11 '15 at 13:57

0 Answers0