-
注意:
- 因为不确定 父层字典 里面的 exam 是否是 字典 Dictionary,所以这里需要 转换 一下Dictionary,再赋值给子字典“exam”的对象“ collectState”。
NSDictionary *dataExamDic = self.dataExamDic;
NSMutableDictionary *dataMutableDic = [NSMutableDictionary dictionaryWithDictionary:dataExamDic];
// 可变字典里面的子字典,不一定也是可变字典,所以再转一下可变的
NSMutableDictionary *examMutableDic = [NSMutableDictionary dictionaryWithDictionary:dataMutableDic[@"exam"]];
[examMutableDic setObject:@"0" forKey:@"collectState"];
// 在逐级添加回来:
[dataMutableDic setObject:examMutableDic forKey:@"exam"];
self.dataExamDic = [NSDictionary dictionaryWithDictionary:dataMutableDic];
示例:
(lldb) po self.dataExamDic
{
answertState = {
answer = "";
result = 0;
};
exam = {
aItem = "\U041f\U0440\U0435\U043f\U043e\U0434\U0430\U0432\U0430\U0442\U0435\U043b\U044c.";
analysisText = "";
collectState = 1;
"exam_question_type" = 1;
result = "<null>";
resultModelEssay = "";
rightResult = b;
translateText = "";
userAnswer = "<null>";
uuid = 0b4b60d025b5442390e7489f49be5c49;
};
"record_uuid" = 4bf222c48b124bd5be1fd1f4c74037be;
state = 1;
type = 1;
}
(lldb)
网友评论