[__NSCFNumber length]: unrecognized selector sent to instance 0x8b3c310’

2014-04-06 19:27:11.954 高仿网易新闻[2828:70b] -[__NSCFNumber length]: unrecognized selector sent to instance 0x8b3c310 2014-04-06 19:27:11.958 高仿网易新闻[2828:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0x8b3c310’

[__NSCFNumber length]: unrecognized selector sent to instance 0x8b3c310’_第1张图片

 


这个错误是作者解析pilst文件中的字段的comments数据类型为NSNumber类型,而在字典转模型时写成了NSString类型,所以报了以上错误;

 




解决方法:
将模型属性中的comments改为NSNumber类型,掉用的时候做一下数据转换

设置属性类型为NSNumber


调用时做下数据类型转换,转成NSString即可


转载:http://www.cnblogs.com/inandroid/p/3649554.html

你可能感兴趣的:([__NSCFNumber length]: unrecognized selector sent to instance 0x8b3c310’)