Thomas Clayson
Thomas Clayson

Reputation: 29925

Can I get and use the contact picture in my app?

I'm using the address book framework to get all the contacts from my iphone phonebook.

Is there any way to get (and use) the contact picture?

Thank you.

Thomas

Upvotes: 1

Views: 2717

Answers (3)

Greg
Greg

Reputation: 8340

Here is a nice article how to pull pictures depending on the iOS version (pre 4.1 and currently preferred method)

Upvotes: 0

k-thorat
k-thorat

Reputation: 5123

Yes you can... this code from the Address Book API

array = [peoplePicker selectedRecords]; 
NSAssert([array count] == 1, @"Picker returned multiple selected records"); 

ABPerson *person = [array objectAtIndex:0];
personImage = [[NSImage alloc] initWithData:[person imageData]]; 
personFirstName = [person valueForProperty:kABFirstNameProperty], personLastName = [person valueForProperty:kABLastNameProperty];
/* ...do something with the image and name... */ [personImage release];

Upvotes: 0

Wim Haanstra
Wim Haanstra

Reputation: 5998

Yes you can. You need to check out the Address Book documentation for iOS and especially look at the ABPerson reference.

http://developer.apple.com/library/ios/documentation/AddressBook/Reference/ABPersonRef_iPhoneOS/Reference/reference.html#//apple_ref/doc/uid/TP40007210

Upvotes: 2

Related Questions