Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

totalBytesExpectedToWrite always -1. Why ? #31

Open
KrLikeblue opened this issue Jul 16, 2016 · 2 comments
Open

totalBytesExpectedToWrite always -1. Why ? #31

KrLikeblue opened this issue Jul 16, 2016 · 2 comments

Comments

@KrLikeblue
Copy link

Hello,

Your library is very useful but I am facing one issue.

I have audio files on my server and I am not calling any API and directly giving path of my audio files to download using your library. Now when download starts in below function, I get totalBytesExpectedToWrite = -1 always. My audio files are around 1MB. It is strange and I am not able to solve it. Can you please help me ? one other thing I noticed is that when I download image, then it is giving me perfect totalBytesExpectedToWrite. but not for audio. In below function, I am getting totalBytesExpectedToWrite = -1.

  • (void)URLSession:(NSURLSession *)session
    downloadTask:(NSURLSessionDownloadTask *)downloadTask
    didWriteData:(int64_t)bytesWritten
    totalBytesWritten:(int64_t)totalBytesWritten
    totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite

Thanks,
Patel

@MrChens
Copy link

MrChens commented Jul 18, 2016

@KrLikeblue because the service which you download from is not support the expectedfilesize。
can you use curl to test? like this curl -I "the url of you downloadfile" --header "Range: bytes=0-"

@KiranJasvanee
Copy link

I've received below data, where I can check there is content-range is available. How can I get it?
HTTP/1.1 206 Partial Content
Server: nginx/1.4.0
Date: Fri, 24 Feb 2017 09:12:07 GMT
Content-Type: video/mp4
Connection: keep-alive
Display: staticcontent_sol
Expires: Sun, 26 Mar 2017 09:12:07 UTC
Response: 206
Vary: Origin,Accept-Encoding,X-APP-JSON
X-Middleton-Display: staticcontent_sol
X-Middleton-Response: 206
Set-Cookie: ezouid_6183=948056624; Path=/; Domain=sample-videos.com; Expires=Thu, 14 Feb 2019 09:12:07 UTC
Set-Cookie: lp_6183=http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4; Path=/; Domain=sample-videos.com; Expires=Fri, 24 Feb 2017 11:12:07 UTC
Set-Cookie: ezoadgid_6183=16; Path=/; Domain=sample-videos.com; Expires=Fri, 24 Feb 2017 09:42:07 UTC
Set-Cookie: active_template::6183=%2Farticle%2Ftwo_column_no_inner_ad; Path=/; Domain=sample-videos.com; Expires=Sun, 26 Feb 2017 09:12:07 UTC
Set-Cookie: ezoab_6183=mod4-; Path=/; Domain=sample-videos.com; Expires=Fri, 24 Feb 2017 09:42:07 UTC
Content-Range: bytes 0-1055735/1055736
Etag: "34168e-101bf8-5357ce5f7ea80"
Last-Modified: Sat, 18 Feb 2017 20:29:48 GMT
Cache-Control: public, max-age=2592000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants