Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacDonaldsd

macrumors 65816
Original poster
Sep 8, 2005
1,005
0
London , UK
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() ?
 
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).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.