Reputation: 821
I have implemented send Email code using MFmailComposer...
it's FINE but the problem is in picking the Email address of the recipient .
i wan t to get the Email address from the address book contacts.
How retrieve this any help please
i have implemented a ABPeoplePickerNavigationController delegate methods for contacts it gives
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier
{
if (property == kABPersonPhoneProperty)
{
ABMultiValueRef emails = ABRecordCopyValue(person, property);
CFStringRef phonenumberselected = ABMultiValueCopyValueAtIndex(emails, identifier);
CFStringRef emailLabelSelected = ABMultiValueCopyLabelAtIndex(emails, identifier);
CFStringRef emailLabelSelectedLocalized = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(emails, identifier));
NSLog(@"\n EmailValueSelected = %@ \n EmailLabelSelected = %@ \n \EmailLabeSelectedlLocalized = %@", phonenumberselected, emailLabelSelected, emailLabelSelectedLocalized);
recipientField.text = (NSString *)emails; //Crashes but accepts 'phonenumberselected'
NSLog(@" emails###:%@... phonenumberselected%@... emailLabelSelected %@.... emailLabelSelectedLocalized %@")
//emails###: ABMultiValueRef 0x80b7bc0 with 1 value(s) //**Log output Displyas like this**
[ self dismissModalViewControllerAnimated:YES ];
return NO;
}
return YES;
How to write code to pick the selected EMail address from phone book
Upvotes: 0
Views: 652
Reputation: 16864
Following link is use for the implemented code where the fetch the email address from contact and add into our array,
Upvotes: 1