标签:
NSDictionary *dict=@{@"key1":@0}; [dict setValue:@5 forKey:@"key1"]; NSLog(@"dict1 ==%@",dict); [dict setValue:@5 forKey:@"key2"]; NSLog(@"dict2 ==%@",dict);
打印内容
*** Terminating app due to uncaught exception ‘NSUnknownKeyException‘, reason: ‘[<__NSDictionaryI 0x7b6c71c0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key key1.‘
解决方案
使用可变字典就可以
标签:
原文地址:http://my.oschina.net/u/2360054/blog/504644