我对 AddressBook 框架有奇怪的行为。我正在以这种方式创建和显示人员选择器控制器:
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonFirstNameProperty], [NSNumber numberWithInt:kABPersonLastNameProperty], nil];
picker.displayedProperties = displayedItems;
[self presentViewController: picker animated:YES completion: nil];
然后在委托中,我有以下内容:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
myPersonRec = person;
[self dismissViewControllerAnimated:YES completion: nil];
return NO;
}
稍后当我尝试访问 myPersonRec 属性时,我只能读取名字和姓氏(显示在人员选择器中),所有其他属性都为零。如果我将返回值更改为YES
,我将获得电话号码和所有东西,但无论如何都无法获得人的图像。我究竟做错了什么?