Get image of a person from iPhone address book

Madhup Singh Yadav picture Madhup Singh Yadav · Jan 18, 2010 · Viewed 8.6k times · Source

How do you get a person's image from an iPhone address book?

Answer

Madhup Singh Yadav picture Madhup Singh Yadav · Jan 18, 2010

You can do it like this....

NSData  *imgData = (NSData *)ABPersonCopyImageData(person);

UIImage  *img = [UIImage imageWithData:imgData];

where person is of type ABRecordRef. Now, as CFData and NSData are toll-free bridged, you can simply type cast CFData to NSData and get the image

Hope this helps.