TAGS :Viewed: 18 - Published at: a few seconds ago

[ 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];}

Answer 1


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;
    }