MBProgressHUD with NSURLConnection

人走茶凉 提交于 2019-11-29 00:43:09

I solved the problem this way, switching from NSURLRequest to NSMutableURLRequestand setting the value none to the encoding (previously in gzip)

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:anURL];
[request addValue:@"" forHTTPHeaderField:@"Accept-Encoding"];

You should check the value of [response expectedContentLength] in didReceiveResponse.

A http server can omit the "Content-Length" header and use "Transfer-Encoding: chunked" instead. In that case the content length is not known a priori and [response expectedContentLength] returns NSURLResponseUnknownLength (which is -1)`.

I could imagine that setting HUD.progress to a negative value causes the CGPathAddArc console messages.

According to the documentation, it can also happen that the accumulated currentLength becomes larger than the expected response length, so you should check for that also.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!