




- (void)_getSandBoxPath {
? ? NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
? ? NSString*cachesPath = [pathArray firstObject];
? ? NSFileManager *fileManger = [NSFileManager defaultManager];
? ? //創(chuàng)建文件夾
? ? NSString *dataPath = [cachesPath stringByAppendingPathComponent:@"HomeListData"];
? ? NSError *createError;
? ? [fileManger createDirectoryAtPath:dataPath withIntermediateDirectories:YES attributes:nil error:&createError];
? ? //創(chuàng)建文件
? ? NSString *listDataPath = [dataPath stringByAppendingPathComponent:@"listData"];
? ? NSData *listData = [@"abc" dataUsingEncoding:NSUTF8StringEncoding];
? ? [fileManger createFileAtPath:listDataPath contents:listData attributes:nil];
? ? //查詢文件
? ? __unused BOOL isExist = [fileManger fileExistsAtPath:listDataPath];
//? ? if (isExist) {
//? ? ? ? [fileManger removeItemAtPath:listDataPath error:nil];
//? ? }
? ? //更新文件
? ? NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:listDataPath];
? ? [fileHandle seekToEndOfFile];
? ? [fileHandle writeData:[@"def" dataUsingEncoding:NSUTF8StringEncoding] error:nil];
? ? [fileHandle synchronizeFile];
? ? [fileHandle closeFile];
}