开发者

ASIHttpRequest resume Downloading

开发者 https://www.devze.com 2023-03-13 22:33 出处:网络
I\'ve got question that similiar to this post ASIHTTP asynchrounous pdf download I am going to resume download using setTemporaryFileDownloadPath: but the weird thing is when I called setDelegate to

I've got question that similiar to this post ASIHTTP asynchrounous pdf download

I am going to resume download using setTemporaryFileDownloadPath: but the weird thing is when I called setDelegate to self and start the connection asynchronously, the cache won't save it to temporaryFileDownloadPath but instead I remark the set delegate, the cache will save to the path.

    _conn = [[ASIHTTPRequest alloc] initWithURL:_currentURL];
    [_conn setDownloadDestinationPath:_currentFileNameWithPath]; 
    [_conn setTemporaryFileDownloadPath:tempPdfLocation];     
    [_conn setAllowResumeForFileDownloads:YES];
    开发者_StackOverflow//[_conn setDelegate:self];
    [_conn startAsynchronous];

I've found that whenever - (void)request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data: was called the cache won't saved. Any Idea?


I used the same thing. Only difference is that I had to set the following selectors:

[_conn setDidFailSelector:@selector(downloadDidFail:)];
[_conn setDidFinishSelector:@selector(downloadDidFinish:)];
[_conn setDidStartSelector:@selector(downloadDidStart:)];

And not implement any of the other delegate methods specified as optional in the ASIHTTPRequestDelegate protocol. Now the download works perfectly and will call the set selectors when needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消