无法识别的选择器发送到实例0x8c9a6d0 [英] unrecognized selector sent to instance 0x8c9a6d0

查看:200
本文介绍了无法识别的选择器发送到实例0x8c9a6d0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我此错误代码中发生了什么

Can anyone tell me what is going on in this error code

[UIViewController collectionView:numberOfItemsInSection:]: unrecognized selector sent to instance 0x8c9a6d0

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController collectionView:numberOfItemsInSection:]: unrecognized selector sent to instance 0x8c9a6d0'

收藏夹查看代码为

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {     
    return [array count];
}

我做错了什么

推荐答案

好吧,看来您没有将正确的实例设置为数据源.

well, seems you don't set the right instance as datasource.

运行时试图在UIViewController上调用该方法.这是错误的,因为那不是正确的课程.

the runtime is trying to call the method on a UIViewController. That is wrong as that cannot be the right class.

我的猜测是您尚未在xib中设置视图控制器的类,因此使用了默认的UIViewController

my guess is that you haven't set your view controller's class in the xib and therefore a default UIViewController is used

这篇关于无法识别的选择器发送到实例0x8c9a6d0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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