开发者

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

开发者 https://www.devze.com 2023-01-19 11:26 出处:网络
I\'m using the address book framework to get all the contacts from my iphone phonebook. Is ther开发者_高级运维e any way to get (and use) the contact picture?

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

Is ther开发者_高级运维e any way to get (and use) the contact picture?

Thank you.

Thomas


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


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];


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号