Мне нужно получить доступ к электронной почте выбранного человека из моего приложения Какао. Я поместил ABPeoplePickerView в главное окно и получил список выбранных людей через [peoplePicker selectedRecords]. Как получить доступ к полю электронной почты объекта ABPerson?
[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; }
Я предполагаю, что на ваш ABPerson объект ссылается person:
person
ABRecordCopyValue( ( ABRecordRef ) person, kABEmailProperty );