NSObject 类的键值编码兼容吗?
我创建了一个加载 plist 的单例类。当我尝试设置值时,我不断收到此错误:
[
对于键测试,此类不符合键值编码。'
我的 plist 文件中有一把钥匙。该键名为“test”,并且没有与之关联的值。我这样设置值:
[[PlistManager sharedManager].plist setValue:@"the title value" forKey:@"test"];
我查看 set plist 字典并从 PlistManager 中看到这一点:
po self.plistDictionary
{
test = "";
}
当我将 PlistManager 留在调试器中时,我收到错误。 PlistManager 是 NSObject 类型。所以没有xib。关于我需要做什么有什么想法吗?
I've created a singleton class that loads a plist. I keep getting this error when I try to set a value:
[<MyPlist 0x1917bc0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key test.'
I have one key in the plist file. The key is named "test" and has no value associated with it. I set the value like this:
[[PlistManager sharedManager].plist setValue:@"the title value" forKey:@"test"];
I look at the set plist dictionary and see this from within PlistManager:
po self.plistDictionary
{
test = "";
}
I get the error just as I'm leaving PlistManager in the debugger. PlistManager is of type NSObject. So no xibs. Any ideas on what I need to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
难道你使用的是非可变字典而不是 NSMutableDictionary 吗?
Could it be that you are using a non-mutable dictionary instead of NSMutableDictionary?