Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 从通讯簿获取iPhone iCloud邮件地址_Ios_Iphone_Objective C_Icloud_Abaddressbook - Fatal编程技术网

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);