我正在尝试从通讯录中删除联系人,然后再次添加。删除没问题,但我无法添加它。没有错误。一个新创建的联系人 ( ABPersonCreate(); ) 有效。
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef allContacts = ABAddressBookCopyArrayOfAllPeople(ab);
ABRecordRef contact = CFArrayGetValueAtIndex(allContacts, 0);
ABAddressBookRemoveRecord(addressBook, contact, nil);
ABAddressBookSave(addressBook, nil);
BOOL addSuccess = ABAddressBookAddRecord(addressBook, contact, &error)
// addSuccess == YES,
// error == null
BOOL saveSuccess = ABAddressBookSave(addressBook, &error)
// saveSuccess == YES
// error == null
未添加联系人!为什么?