在iOS上的地址簿中获取图片联系人 [英] Get image contact in address book on iOS

查看:127
本文介绍了在iOS上的地址簿中获取图片联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新用的地址簿,我会尝试获取手机中联系人的一些信息。是否可以获得所有联系人的图像联系?这将适用于iOS4或更高版本。

I'm new using the Address book and I would try to get some info for the contacts in the phone. Is possible get the image contact of all the contacts? This will be for iOS4 or higher.

提前致谢!

推荐答案

是的,它完全有可能,你只需要询问每个人是否有图像:

Yes it is completely possible, you simply ask each person record whether it has an image:

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

相关函数:

ABPersonHasImageData(person)
ABPersonCopyImageDataWithFormat(person)

ABPersonCopyImageDataWithFormat 返回CFDataRef。
使用此(ARC)将其转换为NSData NSData * data =(__ bridge_transfer NSData *)cfData;

The ABPersonCopyImageDataWithFormat returns a CFDataRef. Convert it to NSData with this (ARC) NSData* data = (__bridge_transfer NSData*) cfData;

然后可以使用创建图像[UIImage imageWithData:data]

这篇关于在iOS上的地址簿中获取图片联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆