使用JSONModel第三方库解析从平台获取的数据
id jsonmodel= [[NSClassFromString(OrderModel) alloc] init];
jsonmodel=[[[jsonmodel class] alloc] initWithDictionary: responseObject[@"data"] error:nil];
onSuccess(jsonmodel,responseObject[@"msg"]);
导致奔溃:
2020-06-25 16:24:25.761602+0800 IICP[6661:310884] -[__NSCFConstantString objectForKeyedSubscript:]: unrecognized selector sent to instance 0x10c2498b8
2020-06-25 16:24:25.902279+0800 IICP[6661:310884] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString objectForKeyedSubscript:]: unrecognized selector sent to instance 0x10c2498b8'
*** First throw call stack:
尝试好久:
问题原因:在写入的数据模型OrderModel中 数据类型和平台获取的数据类型不一致导致;
修改之前:
@property (assign, nonatomic) long long payTime;
修改之后:
@property (strong, nonatomic) NSDate payTime;
希望这篇文章能给那些还在寻找问题答案的程序猿同志,一点曙光,节约一些解决问题的时间;
网友评论