Reputation: 562
Strange things happens to me, I try to create mutable dictionary, but it return an immutable.
NSMutableDictionary * d = [NSMutableDictionary dictionary];
[d setObject:value forKey:key];
The d
NSMutableDictionary
is still NSDictionary
, see in screenshot. And, of course, application crashes then executing [d setObject:value for:key]
Upvotes: 0
Views: 126
Reputation: 243156
Your problem is that your value
is nil
, and you can't set a nil
value into a dictionary.
Don't worry about the __NSCFDictionary *
and NSDictionary
stuff that you see in the variable inspector. You most definitely have a mutable dictionary. What you see in the inspector is artifacts of how NSMutableDictionary
is implemented (as a class cluster).
Upvotes: 4