Is there a way to find a particular kind of email address for a person from the iPhone Address Book? I know how to get all of the email addresses for a person, just not how to identify what kind of e-mail address it is ("home", "work", etc.)...nor (and this might be preferable), a way to directly access that address without having to iterate through them all.
Thanks.
The Contacts app that is built into iOS contains the same information as the Contacts icon inside the Phone app. Any change you make to a contact in either place appears in both locations.
You can search for a contact by name or any other information included on a contact card. In Contacts on iCloud.com, click the group you want to search in the sidebar. If you want to search all contacts, select the All Contacts group.
Go to Settings > Calendar > Accounts > Add Account. Do one of the following: Choose a service: Tap a service—for example, iCloud or Microsoft Exchange—then enter your account information. Add a calendar account: Tap Other, tap Add CalDAV Account, then enter your server and account information.
Answer: A: Answer: A: The suggested contacts are more than just "recent contacts". The contacts that appear are based on not only who you've contacted recently but also on your location and the time of day.
Check for a label of kABWorkLabel using ABMultiValueCopyLabelAtIndex.
For example, if you have an ABRecordRef named "person", this code will set a single NSString named "emailAddress":
// Email address (if only one, use it; otherwise, use the first work email address)
CFStringRef value, label;
ABMutableMultiValueRef multi = ABRecordCopyValue(person, kABPersonEmailProperty);
CFIndex count = ABMultiValueGetCount(multi);
if (count == 1) {
value = ABMultiValueCopyValueAtIndex(multi, 0);
emailAddress = (NSString*)value;
[emailAddress retain];
CFRelease(value);
} else {
for (CFIndex i = 0; i < count; i++) {
label = ABMultiValueCopyLabelAtIndex(multi, i);
value = ABMultiValueCopyValueAtIndex(multi, i);
// check for Work e-mail label
if (label && CFStringCompare(label, kABWorkLabel, 0) == 0) {
emailAddress = (NSString*)value;
[emailAddress retain];
break;
}
CFRelease(label);
CFRelease(value);
}
}
CFRelease(multi);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With