views:

31

answers:

2

hey all,
i want to develop an iPhone app where the app downloads data (say audio clips) from a specified server and stores it locally on the device.
then the app should use the data stored in the device rather than stream it from the server.
could anybody give me the guidelines as to how this can be done? tutorials and samples also appreciated. Thanks :)

+1  A: 

The easiest way to play files from the internet is to use -[AVAudioPlayer initWithContentsOfURL:error:]. If you want to make sure that the whole file is downloaded, I think your best bet would be to download the file using NSURLConnection (see the URL Loading Guide) and then using -[AVAudioPlayer initWithData:error:].

eman
thanks for the response :) but the requirement is to not only download the data from the URL but also to store it in the device.any suggestions on this one? someone told me about using core data (at which i am a novice)...do you think its the right pick?
Bangdel
Definitely not Core Data--it's not good for storing large binary files. Writing and reading from disk is a rather big topic, but take a look at `-[NSData writeToFile:options:error:]` and `+[NSData dataWithContentsOfFile:]`.
eman
A: 

Look into ASIHTTPRequest, you will find it much easier to fetch large chunks of binary over the web asynchronously than if you try to code everything yourself.

Adam Eberbach