2012-05-10 48 views

回答

6

試試這個

#import <AddressBook/AddressBook.h> 
// ... 

- (int)contactsCount {  
    ABAddressBookRef addressBook = ABAddressBookCreate(); 
    CFIndex nPeople = ABAddressBookGetPersonCount(addressBook); 
    CFRelease(addressBook); 
    return (int)nPeople; 
} 
+0

非常感謝,它幫助我... – Shivaay

-1
NSArray *people = [book people]; 
int count = [[book people] count]; 
+0

這不iOS上存在的OSX類。 – Alladinian

+0

NSArray *人= [書籍人]; int count = [[book people] count]; – lex87

0

您可以嘗試使用Erica Sadun的ABContactHelper

至少作爲一個起點。

在ABContactsHelper.h有聲明:

+ (int) contactsCount; 
+ (int) contactsWithImageCount; 
+ (int) contactsWithoutImageCount; 
+ (int) numberOfGroups; 

我認爲這是一個有點過時,所以你可能需要調整代碼一點。

相關問題