我想为 plist 文件条目分配一个布尔值。我正在执行以下操作:
NSString *aBool = realBoolValue ? @"YES" : @"NO";
[myplist setValue: aBool forKey:@"boolKey"];
[myplist writeToFile: [NSHomeDirectory() stringByAppendingPathComponent: plistFilePath] atomically:NO];
但任务从来没有接受过。我这样做是因为以下不起作用:
[myplist setValue: realBoolValue forKey:@"boolKey"];
它给出了不兼容的类型错误。我究竟做错了什么?
- 编辑 - -
plistFilePath 被初始化为
plistFilePath = [NSHomeDirectory() stringByAppendingPathComponent: @"Library/Preferences/myfile.plist"];