-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object' 解决方法:

来源:互联网 发布:mac键盘方向键跳动 编辑:程序博客网 时间:2024/05/22 00:48

-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object' 解决方法:

错误:NSMutableDictionary*d =[[[NSUserDefaults standardUserDefaults] objectForKey:@"xxxx"] mutableCopy];
修改:NSMutableDictionary*d =[NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults]ValueForKey:@"xxxx"]];
这里在plist里读取相关的数据后 没有alloc 崩溃的话 可能是因为这块指针指向的问题
0 0
原创粉丝点击