reason: '[<__NSDictionaryI setValue:forUndefinedKey this class is not key value coding-compliant
崩溃之前的代码
NSMutableDictionary *item = [NSMutableDictionary dictionaryWithDictionary:guaranteedModeDict]; NSMutableDictionary *modelDict = item[MODEL]; [modelDict setValue:[[NSString stringWithFormat:@"%f",minimoney] showShortPriceString] forKey:@"miniMoney"];
崩溃在第三行,字典setValue。
原因是item是可变字典,但是 item[MODEL] 是不可变字典。虽然 modelDict 是可变字典,但是指向了一个不可变字典,最终导致 modelDict 也成了不可变字典。NSMutableDictionary 有 setValue,NSDictionary 无 setValue,崩溃
修改后的代码
NSMutableDictionary *item = [NSMutableDictionary dictionaryWithDictionary:guaranteedModeDict]; NSMutableDictionary *modelDict = [item[MODEL] mutableCopy]; [modelDict setValue:[[NSString stringWithFormat:@"%f",minimoney] showShortPriceString] forKey:@"miniMoney"];
在北京的灯中,有一盏是我家的。这个梦何时可以实现?哪怕微微亮。北京就像魔鬼训练营,有能力的留,没能力的走……