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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:01:31+00:00 2026-06-05T21:01:31+00:00

iam developing one application.In that i need to get the music files from the

  • 0

iam developing one application.In that i need to get the music files from the phone library.For that iam using the MPMediaPickerCOntroller.But it doesn’t fire the didpickingitem delegate method.My code like below.

- (void)viewDidLoad
 {
[super viewDidLoad];
MPMediaPickerController *picker =[[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
picker.delegate                     = self;
picker.allowsPickingMultipleItems   = YES;
picker.prompt                       =@"Add songs to play";
[self presentModalViewController:picker animated: YES];
}

 - (void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) mediaItemCollection 
   {
        NSLog(@"sdfadsf");
        NSLog(@"%@",mediaItemCollection);
        NSArray *slist=[mediaItemCollection copy];
         NSLog(@"%@",slist);

  }
  • 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-05T21:01:34+00:00Added an answer on June 5, 2026 at 9:01 pm

    Do you declare the MPMediaPickerControllerDelegate in your .h?

    ex:

    @interface FirstViewController : UIViewController

    If you do not that would explain why the method isn’t firing. Also, I do not believe it will work on the simulator; only on devices.

    EDIT:

    -(IBAction)presentLibrary:(id)sender
    {
        //this is called from a button press, but you could do it in viewDidLoad
        MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
        picker.delegate = self;
        picker.allowsPickingMultipleItems = NO;
        picker.prompt  = NSLocalizedString (@"Select any song from the list", @"Prompt to user to choose some songs to play");
        [self presentModalViewController: picker animated: YES];    
    }
    
    - (void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
    {
         NSLog(@"didpick");
        if (mediaItemCollection) {
            [_mediaPlayer setQueueWithItemCollection: mediaItemCollection];
            _mediaCollection = mediaItemCollection;
        }
    
        [mediaPicker dismissModalViewControllerAnimated:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam developing one application.In that iam using the uilabels.And my problem is i need
I am developing one application.In that iam using the progress view.In this i need
iam developing one application.In that iam using the xml parsing.That xml file contain the
Iam developing one application.In that i take the string from array and replace .xml
I am developing one application that requires records from Addressbook , I need all
Iam developing one application.In that i need to set the image for segments in
i am developing one application.In that i need to take the capture the video
i am developing one application.In that i perform the xml parsing and get the
I am developing one application and in that application I need to implement push
I am developing a program that need read/write some files from sdcard or internal

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.