我有一个类似于这篇文章的问题ASIHTTP asynchrounous pdf download
我将使用setTemporaryFileDownloadPath恢复下载:但奇怪的是当我将setDelegate调用为self并异步启动连接时,缓存不会将其保存到temporaryFileDownloadPath,而是我注释了set delegate,缓存将保存走的路。
_conn = [[ASIHTTPRequest alloc] initWithURL:_currentURL];
[_conn setDownloadDestinationPath:_currentFileNameWithPath];
[_conn setTemporaryFileDownloadPath:tempPdfLocation];
[_conn setAllowResumeForFileDownloads:YES];
//[_conn setDelegate:self];
[_conn startAsynchronous];
我发现每当 - (void)请求:(ASIHTTPRequest *)请求didReceiveData:(NSData *)数据:被调用时缓存不会保存。有什么想法吗?
答案 0 :(得分:0)
[_conn setDidFailSelector:@selector(downloadDidFail:)];
[_conn setDidFinishSelector:@selector(downloadDidFinish:)];
[_conn setDidStartSelector:@selector(downloadDidStart:)];
并未实现ASIHTTPRequestDelegate
协议中指定为可选的任何其他委托方法。现在下载工作完美,并在需要时调用设置选择器。