[__NSArrayM insertObject:atIndex:]: object cannot be nil'


错误描述;如下图

 

 

分析原因:

1.插入的对象为空了

2.[__NSSetM addObject:] object cannot be nil

[__NSArrayM insertObject:atIndex:] object cannot be nil
使用这两个方法的时候一定要确保object不能是nil,否则程序就会崩溃,在调用之前一定要检查object是不是nil,如果是nil就不能进行add或者insert操作
3.加载图片,特别是网络图片,当网络图片未放置到服务器上时,就会出现这种状况
 
 
解决方法:
 
检测数据插入和添加的位置
检测添加数据是否为空
结合服务器端进行数据联调
检测服务器端图片是否放置在图片服务器上
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 reason: '*** setObjectForKey: object cannot be nil (key: 1)'-crash! Object[] cannot be converted to String[] Cannot format given Object as a Date 'float' object cannot be interpreted as an integer iOS项目运行出现:[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object Cannot assign to read only property 'exports' of object '#' Uncaught TypeError: Cannot assign to read only property 'exports' of object '#' TypeError 之 Cannot convert undefined or null to object Uncaught TypeError: Cannot convert object to primitive value 解决 Cannot assign to read only property 'exports' of object '#' 问题
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM