如何获得iPhone通讯录联系人的电子邮件NSStrings? [英] How to get an iPhone address book contact's emails as NSStrings?
问题描述
我知道电子邮件可以有多个值,但我不知道如何浏览这些值。
我可以正确得到一个人。 / p>
ABRecordRef person = //取得某人
NSString * emails =(NSString *)ABRecordCopyValue(person,kABPersonEmailProperty);
...下一步是什么?如果我尝试打印电子邮件
变量,我得到:
电子邮件: < NSCFType:0x4018d40>
这是因为电子邮件不应是字符串,数组。人们可以有很多电子邮件!
ABMultiValueRef emails = ABRecordCopyValue(person,kABPersonEmailProperty);
CFStringRef email = ABMultiValueCopyValueAtIndex(emails,< INDEX>);
NSLog((NSString *)email);
这里是一些关于MultiValueLists可以做的事情的文档 I know that there can be multiple values for an email, but I'm not sure how to browse through them. I can get a person correctly. ... what's next? If I try to print the
It is because emails should not be a string, but an array. People can have many emails! Here are some docs on things you can do with MultiValueLists 这篇关于如何获得iPhone通讯录联系人的电子邮件NSStrings?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!ABRecordRef person = // getting a person;
NSString* emails = (NSString *)ABRecordCopyValue(person, kABPersonEmailProperty);
emails
variable I get: Emails: <NSCFType: 0x4018d40>
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
CFStringRef email = ABMultiValueCopyValueAtIndex(emails, <INDEX>);
NSLog( (NSString *) email);