本文介绍了如何访问电话联系人列表并将其显示在表格视图中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如表单元格具有:
-
联系方式
Contact image
联系人姓名。
我发现我们必须使用框架:
I found that we have to use framework:
-
AddressBook.framework
AddressBook.framework
AddressBookUI.framework
AddressBookUI.framework
我该如何实现?
推荐答案
ABAddressBookRef addressBook = ABAddressBookCreate(); // create address book reference object
NSArray *abContactArray = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook); // get address book contact array
NSInteger totalContacts =[abContactArray count];
for(NSUInteger loop= 0 ; loop < totalContacts; loop++)
{
ABRecordRef record = (ABRecordRef)[abContactArray objectAtIndex:loop]; // get address book record
if(ABRecordGetRecordType(record) == kABPersonType) // this check execute if it is person group
{
ABRecordID recordId = ABRecordGetRecordID(record); // get record id from address book record
NSString *recordIdString = [NSString stringWithFormat:@"%d",recordId]; // get record id string from record id
NSString *firstNameString = (NSString*)ABRecordCopyValue(record,kABPersonFirstNameProperty); // fetch contact first name from address book
NSString *lastNameString = (NSString*)ABRecordCopyValue(record,kABPersonLastNameProperty); // fetch contact last name from address book
}
}
获取联系人姓氏
以查看更多链接
for more check these links
这篇关于如何访问电话联系人列表并将其显示在表格视图中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!