Reputation: 29925
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
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
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
Reputation: 5998
Yes you can. You need to check out the Address Book documentation for iOS and especially look at the ABPerson reference.
Upvotes: 2