我可以获得home (从kABHomeLabel)、work (从kABWorkLabel)、other (从kABOtherLabel)邮件地址。
但我不知道如何从地址簿中获取iCloud邮件地址。
编辑:
完整的答案(感谢Paulw11):
ABMultiValueRef emailsRef = ABRecordCopyValue(person, kABPersonEmailProperty);
for (int i=0; i<ABMultiValueGetCount(emailsRef); i++) {
CFStringRef currentEmailLabel = ABMultiValueCopyLabelAtIndex(emailsRef, i);
CFStringRef currentEmailValue = ABMultiValueCopyValueAtIndex(emailsRef, i);
NSString *emailLabel = (__bridge NSString *)ABAddressBookCopyLocalizedLabel(currentEmailLabel);
[contactInfoDict setObject:(__bridge NSString *)currentEmailValue
forKey:[NSString stringWithFormat:@"%@Email",emailLabel] ];
CFRelease(currentEmailLabel);
CFRelease(currentEmailValue);
emailLabel = nil;
}
CFRelease(emailsRef);发布于 2014-03-15 23:56:42
按照这个答案中给出的方法-- How to get Custom label and value of the Email in ABAddressBook --应该允许您获取电子邮件字段的标签,包括iCloud标签。
https://stackoverflow.com/questions/22431154
复制相似问题