attempt to insert nil object from objects[0]

attempt to insert nil object from objects

试图从对象插入零对象

该错误出现的原因为对nil属性进行了操作

原因如下:

self.tagList.selectedArray.count <= 0

self.tagList.selectedArray数据源为nil

对nil进行了.count运算

解决问题心得:

解决该问题先找出出错的数组,该数组存在的含义,在哪儿用到,数组里面存放的什么东西。

debug调试是否为nil,为nil对数组做判断

解决方法:

if(self.tagList.selectedArray && self.tagList.selectedArray.count <= 0 )

1.  self.tagList.selectedArray先确定self.tagList.selectedArray不为nil

2.  再对self.tagList.selectedArray进行.count操作

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容