---恢复内容开始---
1. 读取文件 (本地 UTF-8编码的文本文件)
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"song" ofType:@"json"];
NSString *str =[NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
//NSData *data = [NSData dataWithContentsOfFile:filePath];
//NSString *textFile = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
id jsonObj = [str jsonObject];
NSArray *item = [jsonObj objectForKey:@"data"];
NSLog(@"arr %lu %@", (unsigned long)[item count], item);
2. 写入文件
//Document 目录
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];需要的路径
NSString *fileD = [documentSDirectory stringByAppendingPathComponent:@"xxx.txt"];
NSString* fileName = [[filePath objectAtIndex:0] stringByAppendingPathComponent: DBNAME];
[fileData writeToFile:fileName atomically:YES]
---恢复内容结束---