2

我想向用户显示一个人的联系页面,但它显示为 null 。我的代码在下面我只得到一个带有空图像框的黑色联系页面

    ABPersonViewController *personController = [[ABPersonViewController alloc] init];

NSDictionary *dic = [arrayData objectAtIndex:indexPath.row];

ABRecordRef ref = (__bridge ABRecordRef)[dic objectForKey:@"ABRecordRef"];

ABAddressBookRef addressBook = ABAddressBookCreate();

NSLog(@"%@",ref);

ABRecordID recId = ABRecordGetRecordID(ref);

personController.displayedPerson = ABAddressBookGetPersonWithRecordID(addressBook, recId);

personController.displayedProperties = [NSArray arrayWithObjects:
                                        [NSNumber numberWithInt: kABPersonNicknameProperty],
                                        [NSNumber numberWithInt: kABPersonPhoneMobileLabel],
                                        [NSNumber numberWithInt:kABPersonAddressProperty],
                                        nil];


personController.allowsEditing = YES;
personController.personViewDelegate = self;     
personController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Return" style:UIBarButtonItemStylePlain target:self action:@selector(wapis)];

[[self navigationController] pushViewController:personController animated:YES];
4

0 回答 0