加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – [__ NSCFType searchKeyword:]:无法识别的选择

发布时间:2020-12-16 04:53:02 所属栏目:百科 来源:网络整理
导读:以下代码是从storyboard向当前视图添加子视图: EventSearchViewController* view1 = [self.storyboard instantiateViewControllerWithIdentifier:@"searchView"];[view1 setBookingSystem:system];[self.view addSubview:view1.view]; 在视图“view1”中,有
以下代码是从storyboard向当前视图添加子视图:
EventSearchViewController* view1 = [self.storyboard instantiateViewControllerWithIdentifier:@"searchView"];

[view1 setBookingSystem:system];

[self.view addSubview:view1.view];

在视图“view1”中,有一个textField.以下是textField的IBAction,事件是“退出时结束”.

-(IBAction)searchKeyword:(id *)sender
{
    NSLog(@"searchKeyword");
}

以下是错误消息.

2012-05-26 20:26:47.369 OnlineBooking[6607:f803] -[__NSCFType searchKeyword:]: unrecognized selector sent to instance 0x6d8eb80

2012-05-26 20:26:47.369 OnlineBooking[6607:f803] * WebKit discarded an uncaught exception in the webView:shouldInsertText:replacingDOMRange:givenAction: delegate: -[__NSCFType searchKeyword:]: unrecognized selector sent to instance 0x6d8eb80

解决方法

您需要保留EventSearchViewController,或者如果您使用ARC,请保留对它的强引用.如果将它作为局部变量分配给view1,那么在调用searchKeyword:时它就不会再存在了. (错误显示其内存已释放并重新用于其他类型的对象.)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读