【发布时间】:2010-10-17 16:01:06
【问题描述】:
我的 iphone 应用程序中有 plist,我想从我的单向读取和写入一个整数并形成它。
我有这个要读:
scoreData *score = [scoreData sharedData];
filePath = @"stats.plist";
NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
score.highScore = [plistDict objectForKey:@"score"];
然后写给它:
scoreData *score = [scoreData sharedData];
NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
[plistDict setValue:score.highScore forKey:@"score"];
[plistDict writeToFile:filePath atomically: YES];
我在这两个部分都遇到了错误:
objc_object* 到 int 的无效转换
和
int 到 objc_object 的转换格式无效
感谢任何帮助,谢谢。
【问题讨论】:
标签: iphone objective-c plist