3

Cocoa アプリケーションから、選択した人の電子メールにアクセスする必要があります。ABPeoplePickerView をメイン ウィンドウに配置し、選択した人物のリストを[peoplePicker selectedRecords]. ABPersonオブジェクトの電子メール フィールドにアクセスするにはどうすればよいですか?

4

2 に答える 2

2
-(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;
}
于 2012-04-02T09:59:30.597 に答える
0

あなたのABPersonオブジェクトは次のように参照されていると思いますperson

ABRecordCopyValue( ( ABRecordRef ) person, kABEmailProperty );
于 2011-02-26T21:43:43.077 に答える