iOS 编译报错

报错信息
[2174:c07] -[__NSDictionaryI setObject:forKey:]: unrecognized selector sent to instance 0x1457cd60

[2174:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI setObject:forKey:]: unrecognized selector sent to instance 0x1457cd60'

*** First throw call stack:

(0x2442012 0x2267e7e 0x24cd4bd 0x2431bbc 0x243194e 0x5795 0x227b6b0 0x1ca7765 0x23c5f3f 0x23c596f 0x23e8734 0x23e7f44 0x23e7e1b 0x2dc67e3 0x2dc6668 0x11abffc 0x2bdd 0x2b05)

libc++abi.dylib: terminate called throwing an exception

请大神帮看看

你的某一个字典是不可变类型的,非法使用了setObject: forKey:这方法,解决方案:把你的字典类型改为可变的NSMutableDictionary 或者取消setObject: forKey:在个方法
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-10-31
__NSDictionaryI为NSDictionary的一个内部子类。 你创建的是NSDictionary, 而非NSMutableDictionary, 因此无法响应setObject:forKey:方法
相似回答