【发布时间】:2015-10-05 22:30:50
【问题描述】:
我从服务器下载了一个 plist 文件,其中包含键值对。一旦应用程序恢复/重新启动,我必须再次下载文件并检查文件是否已更改。
下面是要下载的代码...我将键值存储在 NSDictionary 中。
task1 = [session dataTaskWithURL:[NSURL URLWithString:[S3_SERVER_URL stringByAppendingString:propFile]] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
propfilePath = [documentsDirectory stringByAppendingString:propFile];
NSLog(@"DestPath : %@", propfilePath);
[receivedData appendData:data];
NSLog(@"Succeeded! Received %lu bytes of data",(unsigned long)[data length]);
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
[data writeToFile:propfilePath atomically:YES];
if(error == nil){
plistDictionary = [[NSDictionary dictionaryWithContentsOfFile:propfilePath] retain];
[task2 resume];
} else {
}
}];
如何比较两个 plist 文件或 NS 字典的内容? 哪个功能最适合执行上述操作我必须在应用程序创建/恢复/重新启动时执行此操作? 应该兼容ios7和ios8 SDK。
【问题讨论】:
-
希望这个问题对你有帮助:stackoverflow.com/questions/17757111/…
-
还有其他方法可以直接比较 plist 文件吗?
标签: ios objective-c ios7 ios8 nsdictionary