如何使用iPhone的联系人列表

时间:2011-01-20 13:58:27

标签: iphone

任何人都可以告诉我如何使用iPhone的联系人列表。

2 个答案:

答案 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);
}