新增声音卡
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
#import "UploadFile.h"
|
||||
#import <Qiniu/QiniuSDK.h>
|
||||
|
||||
#import <AFNetworking.h>
|
||||
@implementation UploadFile
|
||||
|
||||
/// 上传一个文件
|
||||
@@ -33,5 +33,20 @@
|
||||
}
|
||||
} option:nil];
|
||||
}
|
||||
|
||||
+(void)downloadAudioWithFileName:(NSString *)fileName musicUrl:(NSString *)musicUrl mainFileName:(NSString *)mainFileName completion:(void (^) (BOOL isSuccess, NSString *editAudioPath))completion {
|
||||
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:musicUrl]];
|
||||
NSURLSessionDownloadTask *download = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
|
||||
} destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
|
||||
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) safeObjectAtIndex1:0] stringByAppendingPathComponent:mainFileName] stringByAppendingPathComponent:fileName];
|
||||
return [NSURL fileURLWithPath:filePath];
|
||||
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
||||
if (!error) {
|
||||
completion(YES, filePath.path);
|
||||
} else {
|
||||
completion(NO, nil);
|
||||
}
|
||||
}];
|
||||
[download resume];
|
||||
}
|
||||
@end
|
||||
|
Reference in New Issue
Block a user