NSDictionary setValue: forKey:的坑

2017-10-02  本文已影响178人  吓死宝宝了啊

setValue: forKey是NSMutableDictionary的一个扩展方法,当传入的value为nil时为调用removeObjectForKey:方法,对于NSDictionary来说没有removeObjectForKey:
方法,所以会报错 setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key xxx

上一篇 下一篇

猜你喜欢

热点阅读