从iPhone地址簿获取电子邮件地址

编程入门 行业动态 更新时间:2024-10-14 16:22:49
本文介绍了从iPhone地址簿获取电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前能够成功访问并从 peoplePickerNavigationController 获取数据,但我想要做的是访问联系人的电子邮件地址,然后按下联系人姓名后,模态窗口被解除。

I am currently able to successfully access and get data from the peoplePickerNavigationController, but what I would like to do is have the email address of the contact be accessed, then the modal window dismissed when the contact name is pressed.

情形:

"Button is clicked to add a contact AddressBook Modal Window slides into view Name of Contact is pressed If available, the contact's email address is stored in an array Dismiss modal window"

我目前的代码包括:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier { ABMultiValueRef container = ABRecordCopyValue(person, property); CFStringRef contactData = ABMultiValueCopyValueAtIndex(container, identifier); CFRelease(container); NSString *contactString = [NSString stringWithString:(NSString *)contactData]; CFRelease(contactData); NSLog(@"Value is: %@", contactString); [self dismissModalViewControllerAnimated:YES]; return NO; }

推荐答案

这就是我的工作。

if(property == kABPersonEmailProperty) { CFTypeRef prop = ABRecordCopyValue(person, property); CFIndex index = ABMultiValueGetIndexForIdentifier(prop, identifierForValue); NSString *email = (NSString *)ABMultiValueCopyValueAtIndex(prop, index); ... CFRelease(prop); [email release]; }

更多推荐

从iPhone地址簿获取电子邮件地址

本文发布于:2023-06-08 21:32:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/589432.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:电子邮件地址   地址   iPhone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!