Presenting the people picker
ABPeoplePickerNavigationController *peoplePicker = [[ABPeoplePickerNavigationController alloc] init];
peoplePicker.allowsActions = YES;
peoplePicker.allowsEditing = NO;
peoplePicker.peoplePickerDelegate = self;
[self presentViewController:peoplePicker animated:YES completion:nil];
Implementing the ABPeoplePickerNavigationControllerDelegate in iOS 7
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
ABPersonViewController *personViewController = [[ABPersonViewController alloc] init];
personViewController.displayedPerson = person;
[peoplePicker pushViewController:personViewController animated:YES];
return NO;
}
So far so good. The person view controller is presented as expected. iOS7 method returns a value - one could return NO in order to make sure the people picker remains open. In iOS8 the above delegate method was deprecated and new method must be implemented:
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person {
ABPersonViewController *personViewController = [[ABPersonViewController alloc] init];
personViewController.displayedPerson = person;
[peoplePicker pushViewController:personViewController animated:YES];
}
The person view controller is pushed to the people picker but after a fraction of a second the people picker is dismissed (together with the person view controller).
Is there a way to prevent the people picker from dismissing on iOS8? Any other suggestions?