问题描述
我正在尝试使用以下代码片段构建应用程序
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;
说
我无法删除警告。请帮助我在这方面
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的委托设置警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!