PDA

View Full Version : AddressBook C API issue




MacDonaldsd
Oct 8, 2009, 01:38 PM
I am having a strange issue using the C based AddressBook API, whereby if I do a count of all the people in my address book I get a very large number. (it goes up add I add additional contacts). On a test machine I get 42 for 4 contacts. I want to get a count of all the people so I can loop through them.


ABAddressBookRef address_book = ABGetSharedAddressBook();
CFArrayRef all_people = NULL;

all_people = ABCopyArrayOfAllPeople(address_book);

int count = CFArrayGetCount(all_people);




If I do a CFShow of the all_people array, everything looks fine. Am I doing something stupid with CFArrayGetCount() ?



kainjow
Oct 8, 2009, 02:38 PM
Seemed to work for me. How are you looking at count? Also, you may want to use the actual return type, which is CFIndex (signed long).

robbieduncan
Oct 8, 2009, 03:32 PM
Is it possible that it's copying records from groups you are not used to viewing?