kABPersonEmailProperty 返回奇怪的东西
我试图获取 ABRecordRef 的电子邮件地址,如下所示:
ABRecordRef ref = CFArrayGetValueAtIndex( allPeople, i );
NSString *email = [(NSString*) ABRecordCopyValue( ref, kABPersonEmailProperty ) autorelease];
NSLog(@"%@", email);
它返回:
_$!<Home>!$_ (0x6840af0) - [email protected] (0x6840cc0)
电子邮件周围的这些东西是什么?我怎样才能摆脱它?谢谢。
I am tring to get email address of ABRecordRef like this:
ABRecordRef ref = CFArrayGetValueAtIndex( allPeople, i );
NSString *email = [(NSString*) ABRecordCopyValue( ref, kABPersonEmailProperty ) autorelease];
NSLog(@"%@", email);
It returning this:
_$!<Home>!$_ (0x6840af0) - [email protected] (0x6840cc0)
What's this stuff around the email? and how can I get rid of it?Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
kABPersonEmailProperty
的类型为kABMultiStringPropertyType
。没有单一的电子邮件地址属性,一个人可能有一个用于工作的电子邮件地址,一个用于家庭的电子邮件地址,等等。您可以使用
ABMultiValueCopyArrayOfAllValues
获取所有电子邮件地址的数组:要获取电子邮件地址的标签,请使用
ABMultiValueCopyLabelAtIndex
。 “_$!!$
”是一个特殊常量,定义为kABHomeLabel
,还有kABWorkLabel
。kABPersonEmailProperty
is of typekABMultiStringPropertyType
. There is no single email address property, a person might have an email address for work, one for home, etc.You can get an array of all email addresses by using
ABMultiValueCopyArrayOfAllValues
:To get the labels of the email addresses, use
ABMultiValueCopyLabelAtIndex
. "_$!<Home>!$
" is a special constant that's defined askABHomeLabel
, there's alsokABWorkLabel
.基本上是 @omz 答案的更多细节。这是我用来提取家庭电子邮件和人员姓名的代码:
Basically more details for @omz answer. Here is the code I used that extracts home email and the name of the person:
试试这个......
Try out this......