Daan Luttik
Daan Luttik

Reputation: 2855

Downloading large files

I am currently developing a application which has to be able to show offline videos which need to be downloaded first.

The problem was that these videos can be bigger that the memory that I can allocate to my application. So parts that are downloaded have to be saved immediately instead of saved in a NSData object. I'm hearing conflicting stories on whether or not RESTKit should work, and ASIHTTPRequest seems to be deprecated.

I will follow the suggestion from this thread as it seems to be the best option.

NSURLConnection download large file (>40MB)

Upvotes: 4

Views: 1236

Answers (3)

Marcus Adams
Marcus Adams

Reputation: 53830

Consider using NSURLConnection to download the video file and write the data directly to a file (NSFileHandle).

One advantage of using this method is that the NSURLConnection didReceiveData delegate method is continuously called as data is received, so you can update a progress bar.

Upvotes: 3

carlossless
carlossless

Reputation: 1181

Without explaining all the hasle with dealing with HTTP responses by chunks and streams I would recommend using AFDownloadRequestOperation. It supports resuming downloads and has callbacks for showing download progress. I love it and use it in most of my projects.

P.S. It uses AFNetworking, which is a great framework for making all kinds of HTTP requests.

Upvotes: 0

Jsdodgers
Jsdodgers

Reputation: 5312

Check out AFNetworking for network managing. I am not sure if they have video downloading, but the framework works great for images and other types of downloads that I have down before.

Upvotes: 0

Related Questions