我想从下载中显示进度。 我想加载一个Document并在Webview中显示它。
一切正常,只有我的进度( - (void)setProgress:(float)newProgress方法)显示4次并且显示值:0.000000。
甚至 - (void)请求:(ASIHTTPRequest *)请求didReceiveBytes :( long long)bytes方法从接收到的字节1跳转到其原始大小。
我做错了什么?
服务器向我发送响应标头:
{
"Cache-Control" = "private,max-age=0";
"Content-Length" = 22993;
"Content-Type" = "application/vnd.ms-word.document.12";
Date = "Tue, 28 Feb 2012 12:20:18 GMT";
Etag = "\"{EA1043C4-BE59-4775-AAC0-D25141572D94},2\"";
Expires = "Mon, 13 Feb 2012 12:20:18 GMT";
"Last-Modified" = "Wed, 13 Apr 2011 11:04:06 GMT";
MicrosoftSharePointTeamServices = "14.0.0.4762";
"Persistent-Auth" = true;
"Public-Extension" = "http://schemas.microsoft.com/repl-2";
ResourceTag = "rt:EA1043C4-BE59-4775-AAC0-D25141572D94@00000000002";
SPRequestGuid = "e4791157-4b6f-4961-84e1-2979d23bf5bc";
Server = "Microsoft-IIS/7.5";
"Set-Cookie" = "WSS_KeepSessionAuthenticated={d2e7fd96-aad9-429d-b85d-64a13026c693}; path=/, WSS_KeepSessionAuthenticated={d2e7fd96-aad9-429d-b85d-64a13026c693}; path=/, WSS_KeepSessionAuthenticated={d2e7fd96-aad9-429d-b85d-64a13026c693}; path=/";
"X-Content-Type-Options" = nosniff;
"X-Powered-By" = "ASP.NET";
"X-SharePointHealthScore" = 0;
}
ASIHTTPRequest *asiRequestTemp = [ASIHTTPRequest requestWithURL:[NSURL URLWithString: self.documentURL]];
[asiRequestTemp setTimeOutSeconds:10];
[self setAsiRequestDocumentViewer:asiRequestTemp];
[asiRequestDocumentViewer setDelegate:self];
[asiRequestDocumentViewer setUseKeychainPersistence:YES];
[asiRequestDocumentViewer setUseSessionPersistence:YES];
[asiRequestDocumentViewer setShowAccurateProgress:YES];
[asiRequestDocumentViewer setDownloadProgressDelegate:self];
[asiRequestDocumentViewer setDownloadDestinationPath:mediaPath];
[asiRequestDocumentViewer startAsynchronous];
这有什么不对,甚至显示内容长度!
答案 0 :(得分:0)
我遇到了类似的问题。您下载的数据有多大?你有没看过它是怎么进来的? ASIHTTPRequest在成功下载标题之前不会开始更新进度下载,并且我注意到如果数据足够小以进行两次或三次突发,则只会调用值为0.0和1.0的setProgress