Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'd like to save an NSMutableDictionary object in NSUserDefaults . The key type in NSMutableDictionary is NSString , the value type is NSArray , which contains a list of object which implements NSCoding . Per document, NSString and NSArray both are conform to NSCoding . I am getting this error: [NSUserDefaults setObject: forKey:]: Attempt to insert non-property value.... of class NSCFDictionary. Any solution for this? 回答1: I found out one alternative, before save, I encode the root object ( NSArray object) using NSKeyedArchiver , which ends