Commit a9d5a4ec authored by Steven杜宇's avatar Steven杜宇

// 优化上传大文件 UI显示异常问题

parent b32c8ff5
...@@ -538,15 +538,16 @@ extension YHCertificateUploadSheetView: UIDocumentPickerDelegate { ...@@ -538,15 +538,16 @@ extension YHCertificateUploadSheetView: UIDocumentPickerDelegate {
fileCoordinator.coordinate(readingItemAt: url, options:[.forUploading], error: &error) { fileCoordinator.coordinate(readingItemAt: url, options:[.forUploading], error: &error) {
fileUrl in fileUrl in
uploadFilesBlock?(fileUrl)
dismiss() dismiss()
uploadFilesBlock?(fileUrl)
} }
url.stopAccessingSecurityScopedResource() url.stopAccessingSecurityScopedResource()
if let error = error { if let error = error {
printLog("\(error.localizedDescription)")
} }
} else { } else {
print("授权失败") YHHUD.flash(message: "文件授权失败")
dismiss() dismiss()
} }
} }
......
...@@ -111,6 +111,8 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -111,6 +111,8 @@ class YHOSSManager: NSObject, URLSessionDelegate {
callBackBlock(nil, YHErrorModel()) callBackBlock(nil, YHErrorModel())
return return
} }
DispatchQueue.global().async {
let fileExtension = URL(fileURLWithPath: file).pathExtension.lowercased() let fileExtension = URL(fileURLWithPath: file).pathExtension.lowercased()
request.uploadingData = fileData request.uploadingData = fileData
request.bucketName = self.model.bucket request.bucketName = self.model.bucket
...@@ -145,6 +147,7 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -145,6 +147,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
return return
}).waitUntilFinished() }).waitUntilFinished()
} }
}
func getPublic(url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) { func getPublic(url: String, callBackBlock:@escaping (_ success: String?, _ error:YHErrorModel?)->()) {
let bucketName = self.getBucket(url) let bucketName = self.getBucket(url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment