码迷,mamicode.com
首页 > 移动开发 > 详细

iOS.Crash.[__NSArrayM objectForKeyedSubscript:]

时间:2015-05-27 20:36:06      阅读:2190      评论:0      收藏:0      [点我收藏+]

标签:

1. [__NSArrayM objectForKeyedSubscript:]: unrecognized selector sent to instance - source code and screenshot attached

http://stackoverflow.com/questions/21268539/nsarraym-objectforkeyedsubscript-unrecognized-selector-sent-to-instance

2. 关于objectforkeyedsubscript

http://nshipster.com/object-subscripting/

3. NSArray Returning String Instead of Dictionary

http://stackoverflow.com/questions/18782053/nsarray-returning-string-instead-of-dictionary

 

这是由于下面的调用预期返NSDictionary, 然后没有检查返回id 对象的真正类型,而直接

jsonObject[@"key"]; 这样就导致该类的Crash发生。
1 id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonResponse options:kNilOptions error:nil];

 

iOS.Crash.[__NSArrayM objectForKeyedSubscript:]

标签:

原文地址:http://www.cnblogs.com/cwgk/p/4534216.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!