I want to download a audio file from the following link
audio file link
I have tried the other answers that are posted in this site. But I don't want to use ASIHTTPRequest so can anyone please tell me how to download that link content to my document directory.
Steps: Launch the Chrome browser and enter the Chrome Web Store to find Spotify & Deezer Music Downloader. Tap “Add to Chrome” option to install the extension. Go to the website and search the audio you want to download, and then click the “Download” button next to the audio to start downloading.
Well you could write something like this:
//Download data
NSData *data = [NSData dataWithContentsOfURL:<YOUR URL>];
//Find a cache directory. You could consider using documenets dir instead (depends on the data you are fetching)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
//Save the data
NSString *dataPath = [path stringByAppendingPathComponent:@"filename"];
dataPath = [dataPath stringByStandardizingPath];
BOOL success = [data writeToFile:dataPath atomically:YES];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With