[英]Is it ok to cast a NSdictionary object to NSMutableDictionary?
Is it ok to cast a NSdictionary object to NSMutableDictionary? 是否可以将NSdictionary对象转换为NSMutableDictionary?
NSDictionary *dict;
NSMutableDictionary *mDict = (NSMutableDictionary *)dict;
Tried this and it worked fine. 尝试了一下,它工作正常。
No it is not. 不它不是。 If you want a mutable dictionary, make one:
如果您想要可变的字典,请制作一个:
NSMutableDictionary* mutableDict = [dict mutableCopy];
Do not forget in accordance with the rules you own mutableDict
and must release it when you are done with it. 不要忘记按照您拥有的
mutableDict
规则进行 mutableDict
并且必须在完成mutableDict
其释放。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.