|
@@ -89,6 +89,8 @@
|
|
|
// self->curYCDownloadItem = nil;
|
|
|
// }
|
|
|
|
|
|
+ [[boxDownloadFileManager shareInstance] deleteDownloadDonePlistInfoBy:fullPath];
|
|
|
+
|
|
|
} else {
|
|
|
HLog(@"未能将图片保存至相册");
|
|
|
mainBlock(^{
|
|
@@ -116,6 +118,8 @@
|
|
|
// [YCDownloadManager stopDownloadWithItem:self->curYCDownloadItem];
|
|
|
// self->curYCDownloadItem = nil;
|
|
|
// }
|
|
|
+
|
|
|
+ [[boxDownloadFileManager shareInstance] deleteDownloadDonePlistInfoBy:fullPath];
|
|
|
} else {
|
|
|
HLog(@"未能将视频保存至相册");
|
|
|
mainBlock(^{
|
|
@@ -131,6 +135,7 @@
|
|
|
- (void)loadOtherDataFinishedBy:(NSString*)fullPath
|
|
|
{
|
|
|
NSString*filePath = fullPath;
|
|
|
+ self.nasFullPath = fullPath;
|
|
|
|
|
|
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]){
|
|
|
HLog(@"没有找到文件:%@",filePath);
|
|
@@ -148,40 +153,47 @@
|
|
|
[self.navigationController presentViewController:documentPickerVC animated:YES completion:nil];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+//同文件 有了代理 走了 downloadFile 里面的 UIDocumentPickerDelegate
|
|
|
#pragma mark - UIDocumentPickerDelegate
|
|
|
-- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
|
|
|
- // 获取授权
|
|
|
- BOOL fileUrlAuthozied = [urls.firstObject startAccessingSecurityScopedResource];
|
|
|
- if (fileUrlAuthozied) {
|
|
|
- // 通过文件协调工具来得到新的文件地址,以此得到文件保护功能
|
|
|
- NSFileCoordinator *fileCoordinator = [[NSFileCoordinator alloc] init];
|
|
|
- NSError *error;
|
|
|
-
|
|
|
- [fileCoordinator coordinateReadingItemAtURL:urls.firstObject options:0 error:&error byAccessor:^(NSURL *newURL) {
|
|
|
- // 读取文件
|
|
|
- NSString *fileName = [newURL lastPathComponent];
|
|
|
- NSString *pathStr = [newURL absoluteString];
|
|
|
- NSError *error = nil;
|
|
|
- //NSData *fileData = [NSData dataWithContentsOfURL:newURL options:NSDataReadingMappedIfSafe error:&error];
|
|
|
- if (error) {
|
|
|
- // 读取出错
|
|
|
- } else {
|
|
|
- // 上传
|
|
|
- NSLog(@"fileName : %@-- %@", fileName,pathStr);
|
|
|
-
|
|
|
- //
|
|
|
- [[NSFileManager defaultManager] removeItemAtPath:pathStr error:nil];
|
|
|
-// if(self->curYCDownloadItem){
|
|
|
-// [YCDownloadManager stopDownloadWithItem:self->curYCDownloadItem];
|
|
|
-// self->curYCDownloadItem = nil;
|
|
|
+//- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
|
|
|
+// // 获取授权
|
|
|
+// BOOL fileUrlAuthozied = [urls.firstObject startAccessingSecurityScopedResource];
|
|
|
+// if (fileUrlAuthozied) {
|
|
|
+// // 通过文件协调工具来得到新的文件地址,以此得到文件保护功能
|
|
|
+// NSFileCoordinator *fileCoordinator = [[NSFileCoordinator alloc] init];
|
|
|
+// NSError *error;
|
|
|
+//
|
|
|
+// NSURL * firstUrl = urls.firstObject;
|
|
|
+// [fileCoordinator coordinateReadingItemAtURL:urls.firstObject options:0 error:&error byAccessor:^(NSURL *newURL) {
|
|
|
+// // 读取文件
|
|
|
+// NSString *fileName = [firstUrl lastPathComponent];
|
|
|
+// NSString *pathStr = [firstUrl absoluteString];
|
|
|
+// NSError *error = nil;
|
|
|
+// //NSData *fileData = [NSData dataWithContentsOfURL:newURL options:NSDataReadingMappedIfSafe error:&error];
|
|
|
+// if (error) {
|
|
|
+// // 读取出错
|
|
|
+// } else {
|
|
|
+// // 上传
|
|
|
+// NSLog(@"111fileName : %@ -- %@ ---%@", fileName,pathStr,self.nasFullPath);
|
|
|
+//
|
|
|
+// if(!pathStr || [pathStr isEqualToString:self.nasFullPath]){
|
|
|
+// pathStr = self.nasFullPath;
|
|
|
// }
|
|
|
-
|
|
|
- }
|
|
|
- }];
|
|
|
- [urls.firstObject stopAccessingSecurityScopedResource];
|
|
|
- } else {
|
|
|
- // 授权失败
|
|
|
- }
|
|
|
-}
|
|
|
+//
|
|
|
+// //
|
|
|
+// [[NSFileManager defaultManager] removeItemAtPath:pathStr error:nil];
|
|
|
+//// if(self->curYCDownloadItem){
|
|
|
+//// [YCDownloadManager stopDownloadWithItem:self->curYCDownloadItem];
|
|
|
+//// self->curYCDownloadItem = nil;
|
|
|
+//// }
|
|
|
+//
|
|
|
+// [[boxDownloadFileManager shareInstance] deleteDownloadDonePlistInfoBy:pathStr];
|
|
|
+//
|
|
|
+// }
|
|
|
+// }];
|
|
|
+// [urls.firstObject stopAccessingSecurityScopedResource];
|
|
|
+// } else {
|
|
|
+// // 授权失败
|
|
|
+// }
|
|
|
+//}
|
|
|
@end
|