|
@@ -12,6 +12,7 @@
|
|
|
#import "boxSaveFileManager.h"
|
|
|
#import "downStatusModel.h"
|
|
|
#import "boxDownloadFileManager.h"
|
|
|
+#import "AFHTTPSessionManager.h"
|
|
|
|
|
|
@interface receiveView ()
|
|
|
{
|
|
@@ -139,8 +140,47 @@
|
|
|
#pragma mark 获取本地数据库数据
|
|
|
- (void)getAllDataFun{
|
|
|
|
|
|
- [self getBoxDownLoadDataFun];
|
|
|
- [self getBoxSaveDataFun];
|
|
|
+// [self getBoxDownLoadDataFun];
|
|
|
+// [self getBoxSaveDataFun];
|
|
|
+
|
|
|
+ NSString *urlstr = @"https://media.w3.org/2010/05/sintel/trailer.mp4";
|
|
|
+ NSString *url2 = @"http://transfertest.armclouding.com:11010/getFile?path=/mnt/media_rw/B80050B2005078F8/电影/IMG_0914.MP4";
|
|
|
+
|
|
|
+// [[netWorkManager shareInstance] cloudPhoneDownloadCallBackCode:url success:^(id _Nonnull responseObject) {
|
|
|
+//
|
|
|
+// } failure:^(NSError * _Nonnull error) {
|
|
|
+//
|
|
|
+// }];
|
|
|
+
|
|
|
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
|
+ NSString *documentDir = [paths lastObject];
|
|
|
+
|
|
|
+
|
|
|
+ NSString* encodedUrl = [url2 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
|
+ NSURL *url = [NSURL URLWithString:encodedUrl];
|
|
|
+
|
|
|
+ NSURLRequest *request = [NSURLRequest requestWithURL:url];
|
|
|
+ NSURLSessionDownloadTask *task = [[AFHTTPSessionManager manager] downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
|
|
|
+ NSLog(@"%@", [NSString stringWithFormat:@"当前下载进度:%.2f%%",100.0 * downloadProgress.completedUnitCount / downloadProgress.totalUnitCount]);
|
|
|
+ } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
|
|
|
+ NSLog(@"临时文件路径: %@", targetPath);
|
|
|
+
|
|
|
+ NSString *downloadPath = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent: @"Download"];
|
|
|
+ //打开文件管理器
|
|
|
+ NSFileManager *fileManager = [NSFileManager defaultManager];
|
|
|
+ //创建Download目录
|
|
|
+ [fileManager createDirectoryAtPath:downloadPath withIntermediateDirectories:YES attributes:nil error:nil];
|
|
|
+ //拼接文件路径
|
|
|
+ NSString *filePath = [downloadPath stringByAppendingPathComponent:response.suggestedFilename];
|
|
|
+
|
|
|
+ NSURL *path = [NSURL fileURLWithPath:filePath];
|
|
|
+ [path URLByAppendingPathComponent:response.suggestedFilename];
|
|
|
+ return path;
|
|
|
+ } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
|
|
+ NSLog(@"本地存储路径: %@", filePath);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [task resume];
|
|
|
}
|
|
|
|
|
|
#pragma mark 读取保存到盒子的数据库
|