Answer the question
In order to leave comments, you need to log in
Why is file upload progress not showing after exiting the background state?
I'm uploading a file. I use Alamofire. Set up SessionManager to be able to load in the background.
let downloadSession: SessionManager = {
return Alamofire.SessionManager(
configuration: URLSessionConfiguration.background(
withIdentifier: (Bundle.main.bundleIdentifier ?? "") + ".background"
)
)
}()
@discardableResult
static func download(path: String,
parameters: [String: Any]?,
progressBlock: ProgressBlock?,
successBlock: SuccessBlock?,
errorHandlerBlock: ErrorHandlerBlock?) -> DownloadRequest {
return downloadSession.download(URL(string: APIMethod.shortURL + path)!,
method: .get,
parameters: parameters,
encoding: JSONEncoding.default,
headers: defaultMultipartHeaders,
to: FileBrowser.downloadDestination).downloadProgress(closure: { (progress) in
progressBlock?(progress)
}).responseJSON(completionHandler: { (response) in
successBlock?(response.destinationURL)
})
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question