I am filtering contact from the ABAddressBook and then showing it using the IOS7 address book picker Ui.
But I am finding the Picker UI to get out of sync...
I use the following code to remove myself:
ABAddressBookRef addressBook = ABAddressBookCreate();
NSArray *people = (__bridge NSArray *) ABAddressBookCopyArrayOfAllPeople(addressBook);
NSMutableArray * recordsToRemoveArray = [[NSMutableArray alloc]init];
/* Here I decide which records we want to remove
and add them to the 'recordsToRemoveArray */
/* Finally, we iterate through the array of records to remove,
removing them from our copy of the address book: */
for (int l=0; l < recordsToRemoveArray.count; l++) {
ABRecordRef recToRemoveRef = (__bridge ABRecordRef)([recordsToRemoveArray objectAtIndex:l]);
ABAddressBookRemoveRecord(addressBook, recToRemoveRef, nil);
}
However, I am finding that the contacts get out of sync with the 'Letter section'
This only happens if I am the only contact in the section.
E.g. Bob Smith is removed from the Letter 'S' section, but the Picker still shows the 'S' Section, but with the next sections contacts in it!
Anyone know how to avoid this? I haven't found a remove section api or a way to force update the ABAddressBook.