views:

386

answers:

2

Hi

I am using the ASIHTTPRequest source code to download a file from a remote location. Surprisingly, the download happens but nothing happens after that. I have put in a log statement in the handleBytesAvailable method and can see the entire file worth of data is downloaded in parts and added to the fileDownloadOutputStream variable.

But once all the bytes have been downloaded, nothing happens. The delegate methods are not called (neither fail, nor success).

Can someone please tell me what is happening? Or what is the correct way to download a file from a remote server using ASIHTTPRequest?

Thanks.

Few more details

On putting more log statements, it appears that after all the bytes have been downloaded, the request class gets a timeout response. And after that the delegate methods are not called. Not sure why the timeout should happen because I can see from the logs that all the bytes of the file have been downloaded already. Does this help?

A: 

You can set the download location on the request:

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadDestinationPath:@"/Users/ben/Desktop/my_file.txt"]];
ACBurk
I am doing this already. The problem is the file downloads and in the last bit something happens and the delegate methods are not called.
lostInTransit
are you sure it's not a server side error?
ACBurk
+1  A: 

Have you set a delegate on the ASIHTTPRequest object?

Jamie Pinkham
Yes. My class is set as the delegate.
lostInTransit