我有
NSMutableDictionary *mutDic;
Run Code Online (Sandbox Code Playgroud)
它NSMutableDictionary
从一个警报中加载了一些来自我试图更新其值的警报值
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
[self.mutDic setValue:[[alertView textFieldAtIndex:0] text] forKey:@"lname"];
}
Run Code Online (Sandbox Code Playgroud)
但我得到了这个例外
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'
Run Code Online (Sandbox Code Playgroud)
我们如何更新字典?