Post

Replies

Boosts

Views

Activity

How to get upload progress when using "await urlSession.upload()"
How to get upload progress when using: let (data, urlResponse) = try await urlSession.upload( for: urlRequest, from: bodyData, delegate: nil // Something I need here maybe? ) I have tried using: func urlSession( _ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) { print("fractionCompleted : \(Float(totalBytesSent) / Float(totalBytesExpectedToSend))") } Within the same class but it never fires. I specifically want the async / await capability on the upload. I couldn't get the session.uploadTask to work with the await prefix.
2
1
2.6k
Mar ’24
How to get upload progress when using "await urlSession.upload()"
How to get upload progress when using: let (data, urlResponse) = try await urlSession.upload( for: urlRequest, from: bodyData, delegate: nil // Something I need here maybe? ) I have tried using: func urlSession( _ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) { print("fractionCompleted : \(Float(totalBytesSent) / Float(totalBytesExpectedToSend))") } Within the same class but it never fires. I specifically want the async / await capability on the upload. I couldn't get the session.uploadTask to work with the await prefix.
Replies
2
Boosts
1
Views
2.6k
Activity
Mar ’24