0

在我的地址簿应用程序中,当我获取联系人的电子邮件 ID 时,我设置了如下内容:

ABMultiValueRef 0x2994e0 with 1 value(s)
0: null (0x3f5655e0) - xyz@gmail.com (0x2994b0)

如何获取字符串值,即仅

 xyz@gmail.com

从上面的结果?

谢谢

4

1 回答 1

2
// This is what you have currently (i.e. the multivalues)
ABMultiValueRef emailValues = ABRecordCopyValue(person, kABPersonEmailProperty);

// This is how you extract the first item from the multivalues:
CFStringRef cfEmailAddress = ABMultiValueCopyValueAtIndex(emailValues, 0);

// This is how you convert it to an NSString.
NSString *emailAddress = CFBridgingRelease(cfEmailAddress);
于 2012-05-22T23:59:39.360 回答