I'm using Alamofire and found that with the download task and progress I get the correct bytes that it read and the total bytes currently read, but the totalBytesExpectedToRead always -1. Even in the test files the assertion says that this value should be always -1, why?
The download completes with no problem, but I want to show a progress bar while downloading PDF's.
Is it possible that this part of the library is not done yet?
Thank you in advance!
totalBytesExpectedToRead provides you the Content-Length that is received from server side. When server does not providing "Content-Length" value in response header then it would be -1 always. First confirm to webservices and from Web Developers team that they should provide you "Content-Length".
Actually, totalBytesExpectedToRead is give you the value from property of NSURLResponse of "expectedContentLength"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With