我需要从我的Cocoa应用程序访问选定人员的电子邮件。我已经在主窗口上放置了ABPeoplePickerView,并通过[peoplePicker selectedRecords]获得了选定人员的列表。如何访问ABPerson对象的电子邮件字段?
发布于 2012-04-02 17:59:31
-(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;
}发布于 2011-02-27 05:43:43
我假设person引用了您的ABPerson对象
ABRecordCopyValue( ( ABRecordRef ) person, kABEmailProperty );https://stackoverflow.com/questions/5129749
复制相似问题