setobject专题

iOS NSMutableDictionary setValue和setObject区别

一直以来两个都用,但是没有区分过,基本都是处理字符串。今天整理下异同,以后写代码也能开拓思路,优化算法。 1、setValue /* Send -setObject:forKey: to the receiver, unless the value is nil, in which case send -removeObjectForKey:.*/- (void)setValue:(nul

-[__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]; 修改:NS

setValue和setObject的区别

1 setValue: forKey:的定义 @interface NSMutableDictionary(NSKeyValueCoding) /* Send -setObject:forKey: to the receiver, unless the value is nil, in which case send -removeObject:forKey:. */ - (voi