totalBytesExpectedToWrite is -1 in NSURLSessionDownloadTask

后端 未结 3 1006
情深已故
情深已故 2021-01-12 12:34

I faced with a strange problem. I load file from the Internet using NSURLSession and NSURLSessionDownloadTask. Here is the code

NSU         


        
3条回答
  •  别那么骄傲
    2021-01-12 13:05

    The web service may not be providing the total size in the header field Content-Length.

    If the total size is not provided there is no way for your app to know the length and this provide a progress bar.

    Check what is coming from the web server with a analyzer such as Charles Proxy.

提交回复
热议问题