为 ABPeoplePickerNavigationController 设置委托时收到警告

发布于 2024-10-17 07:16:13 字数 760 浏览 8 评论 0原文

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

我的界面定义是,

@interface CreateMessageViewController : UIViewController

并且我作为按钮单击结果调用的方法是

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

现在我收到 picker.peoplePickerDelegate = self; 的警告说

警告:“CreateMessageViewController”类未实现“ABPeoplePickerNavigationControllerDelegate”协议

我无法删除该警告。请在这方面帮助我

任何类型的帮助将不胜感激

提前致谢!

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!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦晓ヶ微光ヅ倾城 2024-10-24 07:16:13

需要为 peoplePickerDelegate 分配支持 ABPeoplePickerNavigationControllerDelegate 协议的内容,而您的控制器类不支持该协议(self 是控制器的实例,以防您不明显)。尝试

@interface CreateMessageViewController : UIViewController  <ABPeoplePickerNavigationControllerDelegate> {}

并实施相关信号

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文