URLSessionTaskDelegate has two methods - didSendBodyData that called every upload progress update, and didCompleteWithError that called at the end of the file transfer.
The problem is that didSendBodyData reaches 100%, and only 2-3 seconds after didCompleteWithError called with success.
This means I have a loader or a progress bar, and only 2-3 seconds after it reaches 100% I can show something on the screen. It is frustrating.
Anybody knows what is the solution here?
Note: Already made sure I update the UI on the main thread.
Thanks!
I would think that is very easy. Your task takes 100% from start to finish. Your task is downloading, plus whatever happens after that. Assign 90% to downloading, and 10% to other things. So your progress goes up to 90%, stays there for two or three seconds, then jumps to 100%.