从iphone中的地址簿中检索联系人详细信息

时间:2011-11-09 09:33:30

标签: iphone

如何从iphone中的地址簿中检索联系人的街道,城市,州和国家

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

        ABAddressBookRef addressBook = ABAddressBookCreate();

NSArray *array= (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);

            ABRecordRef person=(ABRecordRef)[array objectAtIndex:i];
    firstName=(NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
    lastName=(NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
    streeName = (NSString *)ABRecordCopyValue(person, kABPersonAddressStreetKey);
    ciy = (NSString *)ABRecordCopyValue(person, kABPersonAddressCityKey);

不要忘记添加Address Book和AddressBook框架。