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.'
解决方案app
使用可变字典就能够
this