本文介绍了从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地址簿获取电子邮件地址
发布评论