錯誤代碼集合

給不可變數組設置新的key

    
            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

相關文章
相關標籤/搜索