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

-[__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 崩溃的话 可能是因为这块指针指向的问题
 
 
 
 
转自:http://blog.csdn.net/mideveloper/article/details/18356497

猜你喜欢

转载自blog.csdn.net/mscinsidious/article/details/76849700