unrecognized selector sent to instance

2025-04-23 18:01:25

1、NSMutableDictionary 类型数据直接使用 = 赋值后,对象类型隐藏着被改变了,变成了 NSDictionaryI 此种类型,此种类型中没有setObject方法,此时再向源数据中插入数据会报错unrecognized selector sent to instance。

2、解决方法:传递数据时可以使用 = 来简化锟侯希哇处理直接赋值,在最终保存数据并使用数据时需要重新根据数据来构造 NSMutableDictionary。- (void)addCo荏鱿胫协ntrols:(NSMutableDictionary*)controls selectControl:(NSString*)control{ self.controls = [NSMutableDictionary dictionaryWithDictionary:controls]; self.hitControl = control;// NSLog(@"%@ ---- %@",_controls,_hitControl);}

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢