我将一组字典保存到plist文件中。我已经测试了大约150个实例的数组并且工作正常。现在我有大约350个相同的代码不起作用(它可以由什么引起?
Isn工作=创建一个空的plist。
我正在使用TouchJSON将JSON解析为数组 某些词典的某些元素具有NULL值(如果有帮助)
以下是我用来保存数据的代码:
NSString *filePathDocArray = [DOCUMENTS stringByAppendingPathComponent:@"filters.plist"];
NSString *filePathBundleArray = [[NSBundle mainBundle] pathForResource:@"filters" ofType:@"plist"];
//if there is no current filterlist - download and parse the JSON
if (![[NSFileManager defaultManager] fileExistsAtPath:filePathDocArray])
{
[[NSFileManager defaultManager] copyItemAtPath:filePathBundleArray toPath:filePathDocArray error:nil];
NSLog(@"File saved");
}
[APIDownload downloadWithURL:@"url" delegate:self];
完成加载时调用的方法:
- (void)APIDownload:(APIDownload*)request
{
CJSONDeserializer *deserializer = [CJSONDeserializer deserializer];
self.news = [deserializer deserializeAsArray:request.downloadData error:nil];
NSString *filePathDocArray = [DOCUMENTS stringByAppendingPathComponent:@"filters.plist"];
[self.news writeToFile:filePathDocArray atomically:YES];
[news release];
if(TableViewSynthesized) {
[self.tableViewController release];
TableViewSynthesized = NO;
}
}