计算AddressBook iPhone中的电话号码总数

时间:2010-05-14 06:58:27

标签: iphone count abaddressbook

我试图获取所有群组中AddressBook中列出的电话号码的总数。

我可以成功检索人数和组计数,而不是电话号码的总数。

ABAddressBookRef m_addressbook = ABAddressBookCreate();
CFIndex nPeople  = ABAddressBookGetPersonCount(m_addressbook);
CFIndex nGroups  = ABAddressBookGetGroupCount(m_addressbook);

2 个答案:

答案 0 :(得分:1)

CFIndex nPeople = ABAddressBookGetPersonCount(m_addressbook);

应该返回地址簿中每个人的计数。

答案 1 :(得分:1)

试试这个:

ABAddressBookRef addressbook = ABAddressBookCreate();
int nPeople = ABAddressBookGetPersonCount(addressbook);
printf("%d",nPeople);