AddressBook C API issue

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

  1. macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #1
    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.

    Code:
    	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

    kainjow

    Joined:
    Jun 15, 2000
    #2
    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 emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    Is it possible that it's copying records from groups you are not used to viewing?
     

Share This Page