在Plist中读写详细信息

时间:2012-08-08 06:59:11

标签: iphone ios plist

我在xcode的documnet目录中创建了一个plist名称infoD.plist,就像他的enter image description here图像一样

我只是想在我的代码中将NO设置为YES。我喜欢这样

infoD plist objectAtIndex:10 to YES if purchased.if the user purchased something ,i need to chnage the iteam10 value to YES. how to do this.

提前致谢。

1 个答案:

答案 0 :(得分:0)

使用NSMutableDictionary来抓取你的plist

的plist内容
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:<filepath>];

[dict setValue:[NSNumber numberWithBool:YES] forKey:@"item 10"];
[dict writeToFile:<filepath> atomically:YES];