iOS 崩溃问题[__NSCFConstantString objectForKey:]: unrecognized selector sent to instance 0x10b15a470
来源:互联网 发布:下一代通信网络 编辑:程序博客网 时间:2024/06/16 07:39
1.服务器返回的数据类型
{
responseMessage = {
accountid = “”;
data = “”;
errorCode = 0000;
msg = success;
“msg_help” = “”;
“msg_other” = “”;
“msg_statistics” = (
);
sourceCode = “”;
token = “”;
};
responseType = 1;
}
2.崩溃日志
*** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSCFConstantString objectForKey:]: unrecognized selector sent to instance 0x10b15a470’
3.崩溃原因
打印
[info objectForKey:@”responseMessage”],可以正常打印,但是打印字典responseMessage下的key为 [@”data”],程序就会崩溃,仔细分析后发现原因是我解析的后台数据中responseMessage 字典下的 data这个 value 一共有三种类型 :1.字典,2.空字典,3.字符串.
4.解决办法
NSString *imgString = @””;
if ([[[info objectForKey:@”responseMessage”] objectForKey:@”data”] isKindOfClass:[NSDictionary class]]) {
imgString = [[[info objectForKey:@”responseMessage”] objectForKey:@”data”]objectForKey:@”imageName”];
}
对 data 进行判断,
a.如果data 的类型为字典,则对数据进行相应的处理
b.如果data 的类型为非字典,则对数据进行其他操作.
链接:http://v2it.win/ios/ios-%E5%B4%A9%E6%BA%83%E9%97%AE%E9%A2%98__nscfconstantstring-objectforkey-unrecognized-selector-sent-to-instance-0x10b15a470/
- iOS 崩溃问题[__NSCFConstantString objectForKey:]: unrecognized selector sent to instance 0x10b15a470
- -[__NSCFConstantString count]: unrecognized selector sent to instance
- [__NSCFConstantString size]: unrecognized selector sent to instance 0x6ead08
- -[__NSCFConstantString size]: unrecognized selector sent to instance 0xce18c0
- iOS编译错误:[__NSCFConstantString count]: unrecognized selector sent to instance 0x1ada02c
- iOS开发中, '-[__NSCFConstantString size]: unrecognized selector sent to instance 0x10abccc00'
- iOS开发中, -[__NSCFConstantString size]: unrecognized selector sent to instance 0x104ff2c00
- [__NSCFConstantString size]: unrecognized selector sent to instance 错误
- iOS问题:[UIButton setCurrentPage:]: unrecognized selector sent to instance
- 奔溃警告:-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x7a781910
- IOS:unrecognized selector sent to instance
- Unrecognized Selector Sent to Instance问题
- iOS 【错误:unrecognized selector sent to instance 0x7aa552b0】
- IOS [NSNull objectForKey:]: unrecognized selector sent to [NSNull null]
- unrecognized selector sent to instance 0x81de740
- unrecognized selector sent to instance 0x266070
- unrecognized selector sent to instance 0x266070
- unrecognized selector sent to instance 0x10b34e810
- Codeforces Round #326 (Div. 1)-B. Duff in Beach
- IntelliJ Idea 常用快捷键列表
- 翻转数组
- 微信公众平台开发:接入JS-SDK和实现分享功能
- 英文字母和中文汉字在不同字符集编码下的字节数
- iOS 崩溃问题[__NSCFConstantString objectForKey:]: unrecognized selector sent to instance 0x10b15a470
- ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after XXX ms
- 动态添加radiobutton时,设置margin
- [LeetCode]--205. Isomorphic Strings(同构字符串)
- android源码编译
- 名字、身份证号校验;浮点数据精确度限制小工具整理
- 深入剖析Android音频之AudioSystem
- Linux学习——shell命令
- SQL Case when 的使用方法