topgun
topgun

Reputation: 2573

Storing ASIHttpRequest PDF as NSData

I have a pdf which I am trying to store temporary in memory, and give option to the user if s/he wants to save the pdf to iPhone. I am using Asihttprequest to talk to the server, therefore I am just curious, what is the best way to setDownloaddestination as nsdata?

Thanks.

Upvotes: 0

Views: 309

Answers (1)

Greg
Greg

Reputation: 168

I've never used ASIHTTPRequest, however does this from the documentation solve your answer?

Downloading the response directly to a file

If the resource you are requesting is fairly large, you can save memory by downloading directly to a file. This way, ASIHTTPRequest won’t have to keep the whole response in memory at once.

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadDestinationPath:@"/Users/ben/Desktop/my_file.txt"];

Came from about 20% of the way down http://allseeing-i.com/ASIHTTPRequest/How-to-use.

Upvotes: 1

Related Questions