如何从联系人获取图像

时间:2012-02-16 10:32:06

标签: iphone abaddressbook

我添加了框架:

#import "AddressBook/ABAddressBook.h"
#import "AddressBookUI/AddressBookUI.h"

我想获取图片。您可以修改我的代码,或者给我链接

ABAddressBookRef addressBook = ABAddressBookCreate();
    CFArrayRef nameArray = ABAddressBookCopyArrayOfAllPeople (addressBook);

    m_SourceContactsUserArray = [[NSMutableArray alloc] init];
    for (int i = 0; i<CFArrayGetCount(nameArray); i++) {
        ABRecordRef person = CFArrayGetValueAtIndex(nameArray, i);
        NSString *personName = (NSString*)ABRecordCopyValue(person,kABPersonFirstNameProperty);
        [m_SourceContactsUserArray addObject:personName];
    }
    CFRelease(addressBook);
    CFRelease(nameArray);
非常感谢你。