您的位置:首页 > 移动开发 > Objective-C

iOS.Crash.[__NSArrayM objectForKeyedSubscript:]

2015-05-27 19:16 513 查看
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发生。


id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonResponse options:kNilOptions error:nil];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐