I'd like to get a list of all ABContacts that have a phone number and only those contacts. Any contacts with just an email I do not want to show.
Android has a field called HAS_PHNONE_NUMBER you can query on but I'm not seeing anything like that for iPhone.
For example:
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
//How do I filter people into an array of contacts that all have a phone number?
You can use this code snippet
CFIndex numberOfPeople = CFArrayGetCount(_allPeople);
for (int i=0;i < numberOfPeople;++i) {
ABRecordRef ref = CFArrayGetValueAtIndex(_allPeople, i);
ABMultiValueRef phones =(NSString*)ABRecordCopyValue(ref, kABPersonPhoneProperty);
int phoneNumbersCount = ABMultiValueGetCount(phones);
if (phoneNumbersCount>0)
{
// save this contact, it has phone number
}
}