In AddressBook of iPad,when i am trying to add a email, I have an option to set my own Custom Label and give the email,
Problem: I am not able to fetch that particular label and its value, I am able to get other,iCloud,home,work email IDs from Addressbook.
This is the Code related to what i have done:
//Email
ABMultiValueRef emailID = ABRecordCopyValue(recordRef, kABPersonEmailProperty);
CFIndex emailCount = ABMultiValueGetCount(emailID);
// PSLog(@"counter %ld",emailCount);
NSString *emailLabel;
NSMutableArray *emailLabelsMutArr = [NSMutableArray new];
if (emailCount == 0) {
[nameEmailMutDict setValue:@"No Mail ID" forKey:kEmailKey];
}
else
{
for(CFIndex emailCounter = 0; emailCounter < emailCount; emailCounter++)
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setValue:contactFirstName forKey:kEmailFirstNameKey];
[dict setValue:contactLastName forKey:kEmailLastNameKey];
emailLabel = (__bridge NSString*)ABMultiValueCopyLabelAtIndex(emailID, emailCounter);
[emailLabelsMutArr addObject:emailLabel];
NSString *strEmail = (__bridge NSString *)(ABMultiValueCopyLabelAtIndex(emailID, emailCounter));
if ([emailLabel isEqualToString:@"_$!<Home>!$_"]) {
strEmail = (__bridge NSString*)ABMultiValueCopyValueAtIndex(emailID, emailCounter);
[dict setValue:strEmail forKey:kEmailKey];
contactsObject.contactEmailModal = strEmail;
[self.recordsMutableArray addObject:dict];
continue;
}
}
}