I have a subclass of ABPeoplePickerNavigationController
to handle selecting a contact phone number in my app. Everything works great on iOS 7 and below.
On iOS 8, however, my ABPeoplePickerNavigationControllerDelegate
does not get hit when selecting a phone number. Instead, it just calls that phone number.
I noticed that the method I was using to handle contact selection in iOS 7 (peoplePickerNavigationController:shouldContinueAfterSelectingPerson:property:identifier:
) was deprecated in iOS 8. This method was replaced by peoplePickerNavigationController:didSelectPerson:property:identifier:
.
I know my delegate is set because I successfully receive the peoplePickerNavigationControllerDidCancel:
method callback.
Has anyone else experienced this issue?
Here's a code snippet of my ABPeoplePickerNavigationController
subclass:
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
[self peoplePickerNavigationController:peoplePicker shouldContinueAfterSelectingPerson:person property:property identifier:identifier];
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
...do stuff...
return NO;
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
return YES;
}
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
[self dismissViewControllerAnimated:self.shouldAnimateDismiss completion:NULL];
}
Where are you specifying the peoplePickerDelegate
?
In iOS 8, if you specify peoplePickerDelegate
in viewDidLoad
, you will experience the curious behavior you describe (cancel delegate works, the didSelect...
and shouldContinue...
do not). If you specify peoplePickerDelegate
immediately after init
(or during), it works fine.
This would appear to be an iOS 8 "feature". I'll file a bug report.
above two delegate methods are deprecated in iOS 8.0, use last two methods for getting your desire result
this is apple developer guideline link give you more information about
ABPeoplePickerNavigationControllerDelegate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With