mardi 29 mars 2016

How to store audio file in sqlite database in iOS

I am developing an iPhone application for an audio player. I want to give some options to the user so they can listen to the song/music by streaming or they can download the audio file and store in sqlite database. I know how to stream the audio files in the app programmatically. But I don’t know how to store the downloaded audio file in sqlite database using BLOB. Additionally, after storing the audio file in the sqlite DB I need to fetch the audio file and play the song. How do I fetch the audio file from sqlite DB?

This is my code for downloading the audio file.

NSURL *url = [NSURL URLWithString:@"http://ift.tt/1RHhpVy"];

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];

[request setDownloadDestinationPath:[NSString stringWithFormat:@"%@",dataPath]]; 

[request setDelegate:self];

[request startAsynchronous];

Aucun commentaire:

Enregistrer un commentaire