Locally cache mp3 file with use of ASIHttp request.

This post will describe about “Locally cache file into device memory”.
You may also consider it as “accessing that file when that file is download and reuse file thus the increase the application speed in an iPhone/iPad application”. In that we can use the ASIHttp request and that request through we can download and store that file and reuse that file.

1) Copy ASIHTTP folder into project.

2) Set the header path for access the file.

for more details for ASIHttp request click here.

3) Following code method insert into AppDelegate.h file

4) Following code insert into AppDelegate .m file

5) Following code insert into .h file

6) Following code insert into .m file

  • Synthesize the variable

  • Create method name as playAudio which connect to the button press event.
  • Following method for ASIHttp request method when the request is fail then it is call.
  • Following method for ASIHttp request method When the request is finish  then it is call.


Grab the sample code from here.

Leave a Reply

Your email address will not be published. Required fields are marked *