1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

AddressBook C API issue

Discussion in 'Mac Programming' started by MacDonaldsd, Oct 8, 2009.

  1. macrumors 65816


    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() ?
  2. Moderator emeritus


    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).
  3. Moderator


    Staff Member

    Is it possible that it's copying records from groups you are not used to viewing?

Share This Page