I want to delete a contact from the address book in iPhone how can we do that ?
Thanks
Here is a sample code to do the same:
- (void)delAllContacts {
ABAddressBookRef addressBook = CFBridgingRetain((__bridge id)(ABAddressBookCreateWithOptions(NULL, NULL)));
int count = ABAddressBookGetPersonCount(addressBook);
if(count==0 && addressBook!=NULL) { //If there are no contacts, don't delete
CFRelease(addressBook);
return;
}
//Get all contacts and store it in a CFArrayRef
CFArrayRef theArray = ABAddressBookCopyArrayOfAllPeople(addressBook);
for(CFIndex i=0;i