gpt4 book ai didi

objective-c - 如何从 ABPeoplePickerView 中的选定 ABPerson 获取电子邮件

转载 作者:搜寻专家 更新时间:2023-10-30 20:22:59 27 4
gpt4 key购买 nike

我需要从我的 Cocoa 应用程序访问选定人员的电子邮件。我已将 ABPeoplePickerView 放在主窗口上,并通过 [peoplePicker selectedRecords] 获得了选定人员的列表。如何访问 ABPerson 对象的电子邮件字段?

最佳答案

-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker 
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier
{
NSString *email = nil;
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
if(emails){
email = (NSString *) ABMultiValueCopyValueAtIndex(emails,0);
[email autorelease];
}

[self dismissModalViewControllerAnimated:YES];
emaillabel.text = email;
return YES;
}

关于objective-c - 如何从 ABPeoplePickerView 中的选定 ABPerson 获取电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5129749/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com