Ios 从通讯簿获取iPhone iCloud邮件地址
我可以获得Ios 从通讯簿获取iPhone iCloud邮件地址,ios,iphone,objective-c,icloud,abaddressbook,Ios,Iphone,Objective C,Icloud,Abaddressbook,我可以获得home(来自kABHomeLabel)、work(来自kABWorkLabel)、其他(来自kABOtherLabel)邮件地址 但我不知道如何从通讯簿中获取iCloud邮件地址 编辑: 完整答案(感谢Paulw11): ABMultiValueRef emailsRef=ABRecordCopyValue(person,kABPersonEmailProperty); 对于(int i=0;i,遵循此答案中给出的方法--应该允许您获取电子邮件字段的标签,包括iCloud标签 ABM
home
(来自kABHomeLabel
)、work
(来自kABWorkLabel
)、其他
(来自kABOtherLabel
)邮件地址
但我不知道如何从通讯簿中获取iCloud
邮件地址
编辑:
完整答案(感谢Paulw11):
ABMultiValueRef emailsRef=ABRecordCopyValue(person,kABPersonEmailProperty);
对于(int i=0;i,遵循此答案中给出的方法--应该允许您获取电子邮件字段的标签,包括iCloud标签
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);