接口请求数据 缓存本地 .plist 文件
//奖获取的数组或者字典存入 financeArr 数据数组
1。//本地保存
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
//获取完整路径
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *plistPath = [documentsDirectory stringByAppendingPathComponent:@"Test.plist"];//这里就是你将要存储的沙盒路径(.plist文件,名字自定义)
[financeArr writeToFile:plistPath atomically:YES];
2。//取出缓存
//获取路径
NSArray *sandboxpath= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [[sandboxpath objectAtIndex:0] stringByAppendingPathComponent:@"Test.plist"];
//获取数据
NSMutableArray *dataArr = [NSMutableArray arrayWithContentsOfFile:filePath];
//dataArr就是得到缓存数据数组
写的不好 有错误的地方望大家多多指点