Abpersonviewcontroller没有显示任何细节

时间:2013-05-21 07:48:48

标签: ios

我想向用户显示某人的联系页面,但显示为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];

0 个答案:

没有答案