Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:49:39+00:00 2026-06-03T11:49:39+00:00

i need to download a mp3 file from internet through my application and i

  • 0

i need to download a mp3 file from internet through my application and i found a solution , to use NSURLConnection and connection request. here is my code (code from another faq)

 - (IBAction)downloadData:(id)sender
 {
    NSURL *myURL = [NSURL URLWithString:@"http://www.example.org/mp3song"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:myURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];

   [[NSURLConnection alloc] initWithRequest:request delegate:self];
 }


 - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response 
 {
   responseData = [[NSMutableData alloc] init];
 }


 - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 
 {
   [responseData appendData:data];
 }


  - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error 
  {
   [responseData release];
   [connection release];

  }


 - (void)connectionDidFinishLoading:(NSURLConnection *)connection 
 {
    NSLog(@"Succeeded! Received %d bytes of data",[responseData
                                               length]);

    NSString *txt = [[[NSString alloc] initWithData:responseData encoding: NSASCIIStringEncoding] autorelease];
 }

how will i save this response data mp3 file to my local file of iPhone?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:49:40+00:00Added an answer on June 3, 2026 at 11:49 am

    so i found the solution after a long googling which i forget to add the code

     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *fileName = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"myFile"];
    
       [responseData writeToFile:fileName atomically:YES];
    

    thankyou

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello friends I need to download mp3 file from the internet and to store
I need to download a mp3 file from a server URL, and then play
I need to download a .mp3 or .m4a file from the server by using
I need to download an .mp3 audio file from a server to save in
i am developing an android application into it i need to download mp3 file
Need to login and download xml file from the below url : http://www.radionyhetene.net/download/nyheter/mp3/nyheter.xml I
I need to download file from FTP server and make some changes on it
I need to download one file from an url that i give from an
I need to download an XML file, using HTTP protocol, to use it locally
I am in need to use This Class to server multiple files (img/video/mp3) from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.