My goal is to allow the user to import contact details (phone, name and email) from contacts. When I set up an ABPeoplePickerNavigationController and set the delegate to self, the delegate methods are not being called. The people picker view is being displayed Here is my code:
-(IBAction)importFromContacts:(id)sender
{
ABPeoplePickerNavigationController *newNavController = [[ABPeoplePickerNavigationController alloc] init];
newNavController.delegate = self;
[self presentViewController:newNavController animated:YES completion:nil];
}
-(void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
NSLog(@"cancel");
[self dismissViewControllerAnimated:YES completion:nil];
}
What am I missing? I would also like to add that the class ABPeoplePicker does not seem to be part of the UIAddressBook framework anymore. It is not in the docs either.
You're setting
delegate, which describes the object that should handle UINavigationController's delegate methods.Change
to
(As described in the Class Reference, ABPeoplePickerNavigationController is a subclass of UINavigationController. It's not out of the ordinary for an object to have multiple delegates, even within the same class.)