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 7860027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:07:24+00:00 2026-06-02T22:07:24+00:00

I am developing an iPhone app for music. I want to give some options

  • 0

I am developing an iPhone app for music. I want to give some options to the user so they can listen the song/music by streaming or they can download the music in the app. I know how to stream the audio files in the app programmatically. But, i don’t know how to download the audio files in the app and play the audio after download. And also user can pause the download while it is in download. Is it possible to do ? Can anyone please guide me and please share any sample code or tutorial for me? I have one more doubt: Can you please help me to create a folder inside of the app? Please help me. Thanks in advance.

  • 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-02T22:07:25+00:00Added an answer on June 2, 2026 at 10:07 pm

    Creating a Folder

    For every app you have a Documents Folder. Any files you use in your app are stored here. If you want to create more directories here, then you’d do something like this:

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
    NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"MyNewFolder"];
    
    if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
        [[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:&error]; //Create folder if it doesn't already exist
    

    Downloading

    If you want to download audio files from the internet, then you want to look at an asynchronous method of doing it. This means that the application can carry on doing things while your download happens in the background.

    For this, I recommend you use ASIHTTPREQUEST. It’s great for carrying out any download requests, providing you with many options such as pausing a download (as you requested).

    The website provides a great deal of documentation on downloading and storing a file. Take a look at the Downloading a File section on this page.

    You’d just do something like:

    NSURL *url = [NSURL URLWithString:@"http://www.fileurl.com/example.mp3"];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDownloadDestinationPath:[NSString stringWithFormat:@"%@",dataPath]]; //use the path from earlier
    [request setDelegate:self];
    [request startAsynchronous];
    

    Then just handle the progress and completion through the delegate methods that ASIHTTPRequest offers.

    Playing

    Playing the file is very simple. Once it’s on the device and you know where it is, just load it into the audio player.

    There’s a great tutorial here on using AVAudioPlayer to play sounds. A very simple example of using it in your case would be:

    NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/audiofile.mp3",dataPath];
    
    NSError *error;
    audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
    
    if (audioPlayer == nil)
        NSLog([error description]);
    else
        [audioPlayer play];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an iPhone app. In a label, I want to show an user's
I am developing an IPhone app. The user can post to his wall and
I am developing an iPhone app and I want to put some datas to
Am developing an iPhone app. From my app user can to follow my twitter
I am developing a music mixing app in iphone. It'll mix the music and
guys. I'm developing iphone app. so, I want to read database of iphone calendar.
I am developing on iPhone app, Where i want to capture the other applications
I'm developing an iPhone app where I need to have some images. Particulary I
I'm developing an iPhone app which displays some tiles from a map. I've got
I am developing an iPhone app which uses Settings.bundle to let the user choose

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.