NSObject类的键值编码兼容?

4th*_*ace 3 iphone cocoa-touch objective-c plist

我创建了一个加载plist的单例类.当我尝试设置值时,我不断收到此错误:

[<MyPlist 0x1917bc0> setValue:forUndefinedKey:]: 对于关键测试,这个类不符合关键值编码.

我在plist文件中有一个键.密钥名为"test",没有与之关联的值.我设置这样的值:

[[PlistManager sharedManager].plist setValue:@"the title value" forKey:@"test"];
Run Code Online (Sandbox Code Playgroud)

我查看set plist字典并在PlistManager中查看:

po self.plistDictionary
{
  test = "";
}
Run Code Online (Sandbox Code Playgroud)

我得到错误就像我在调试器中留下PlistManager一样.PlistManager的类型为NSObject.所以没有xibs.关于我需要做什么的任何想法?

Geo*_*lly 17

可能是你使用的是非可变字典而不是NSMutableDictionary?