Getting warning in setting delegate for ABPeoplePickerNavigationController

595 Views Asked by At

I am trying to build an app with the following code snippets

My Interface definition is

@interface CreateMessageViewController : UIViewController

and the method I am calling as result of Button click is

-(IBAction) handleEvents:(id) sender
 {
    if ((UIButton *) sender == openContact)
    {
       ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
       picker.peoplePickerDelegate = self;
       [self presentModalViewController:picker animated:YES];
       [picker release];
    }}

Now I am getting a warning for picker.peoplePickerDelegate = self; saying

warning: class 'CreateMessageViewController' does not implement the 'ABPeoplePickerNavigationControllerDelegate' protocol

I am not able to remove the warning. Please help me out in this regard

Any kind of help would be highly appreciated

Thanks in advance!!

1

There are 1 best solutions below

2
On BEST ANSWER

peoplePickerDelegate needs to be assigned something that supports the ABPeoplePickerNavigationControllerDelegate protocol which your controller class doesn't (self is an instance of you controller in case that was not obvious to you). Try

@interface CreateMessageViewController : UIViewController  <ABPeoplePickerNavigationControllerDelegate> {}

and implement the relevant signals