简体   繁体   中英

ABPersonViewController is not showing facetime button?

I get contacts using ABPeoplePickerNavigationController and when i select any one of these contacts, i get details of that person using ABPersonViewController . From apple documents, we will get face time button on ABPersonViewController using allowsActions: method. But i did not get face time. I have used following code..

- (BOOL)peoplePickerNavigationController: 
(ABPeoplePickerNavigationController *)peoplePicker 
shouldContinueAfterSelectingPerson:(ABRecordRef)person { 
// NSLog(@"shouldContinueAfterSelectingPerson"); 
ABPersonViewController *picker = [[ABPersonViewController alloc] init] ; 
picker.personViewDelegate = self; 
picker.displayedPerson = person; 
picker.displayedProperties=@[@(kABPersonPhoneProperty),@(kABPersonEmailProperty),@(kABPersonBirthdayProperty),@(kABPersonOrganizationProperty),@(kABPersonJobTitleProperty),@(kABPersonDepartmentProperty),@(kABPersonNoteProperty),@(kABPersonCreationDateProperty)]; 
picker.allowsActions=YES; 
[self.navigationController pushViewController:picker animated:YES];}

I got answer. I have used [self.navigationController pushViewController:picker animated:YES] instead of [peoplePicker pushViewController:picker animated:YES] . That's why i didn't get what i wanted. The reason is, when i write [self.navigationController pushViewController:picker animated:YES] , the default ABPersonViewController will be come. So facetime, shareContact and Add to Favorites buttons are not there. But when i write [peoplePicker pushViewController:picker animated:YES] , created custom ABPersonViewController and all buttons are there using allowsActions: method.

 - (BOOL)peoplePickerNavigationController:
    (ABPeoplePickerNavigationController *)peoplePicker
          shouldContinueAfterSelectingPerson:(ABRecordRef)person {

                ABPersonViewController *picker = [[ABPersonViewController alloc] init];
                picker.personViewDelegate = self;
                picker.displayedPerson = person;
                picker.displayedProperties = peoplePicker.displayedProperties;
                picker.allowsActions = YES;
               [peoplePicker pushViewController:picker animated:YES];
           return NO;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM