+ (NSString *)getAppDocumentDir
{
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES) objectAtIndex:0];
}
+ (void)saveListenDataWithFileName:(NSString *)fileName
AndData:(NSData *)data
AndFinishBlock:(void(^)(NSString *path,bool success))block;{
NSString *path = [NSString stringWithFormat:@"kapEpUser%@ListenData%@sound.%@",[KapUserAccountStore loadActiveUserID],fileName,KapRecordFileUtil.MusicType];
NSString *finallyPath = [self theAppDocuPathWithPath:path];
// bool bo = [data writeToFile:path atomically:YES];
NSError *error = nil;
BOOL bo = [data writeToFile:finallyPath options:NSDataWritingAtomic error:&error];
NSLog(@"%@,error=%@",error?@"写入失败":@"写入成功",error);
if (block) {
block(path,bo);
}
}
+ (NSString *)theAppDocuPathWithPath:(NSString *)path{
NSString *documentpathString = [KapAppUtil getAppDocumentDir];
return [NSString stringWithFormat:@"%@/%@",documentpathString,path];
}
存的时候不要将documentpathString 也拼入path, documentpathString是会变得~~~`
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。