在为ABPeoplePickerNavigationController的委托设置警告 [英] Getting warning in setting delegate for ABPeoplePickerNavigationController

查看:275
本文介绍了在为ABPeoplePickerNavigationController的委托设置警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码片段构建应用程序

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

我的界面定义是

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

现在我收到了选择器的警告。 peoplePickerDelegate = self;


警告:class'CreateMessageViewController'不实现'ABPeoplePickerNavigationControllerDelegate' p>

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

提前感谢!

推荐答案

peoplePickerDelegate 需要分配支持 ABPeoplePickerNavigationControllerDelegate 协议,您的控制器类不会(self是您的控制器的一个实例,以防您对此不明显)。尝试

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

并实施相关信号

这篇关于在为ABPeoplePickerNavigationController的委托设置警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆