任何人都可以告诉我如何使用iPhone的联系人列表。
答案 0 :(得分:2)
答案 1 :(得分:2)
希望找到这个有用的。
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);
for( int i = 0 ; i < nPeople ; i++ )
{
ABRecordRef person = CFArrayGetValueAtIndex(allPeople, i );
//Get First Name
NSString* firstName = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
//Get Last Name
NSString* lastName = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
}