0

I can get home (from kABHomeLabel), work (from kABWorkLabel), other (from kABOtherLabel) mail addresses.

But I can't figure out how to get iCloud mail address from Address Book.

EDIT:

Complete answer (thanks to 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);
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
Victor
  • 914
  • 12
  • 15

1 Answers1

0

Following the method given in this answer - How to get Custom label and value of the Email in ABAddressBook - should allow you to get the labels for the email fields, including the iCloud label.

Community
  • 1
  • 1
Paulw11
  • 108,386
  • 14
  • 159
  • 186