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

  • Home
  • SEARCH
  • 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 9162795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:17:51+00:00 2026-06-17T14:17:51+00:00

I am programming to get the iPhone music library to display, the user selects

  • 0

I am programming to get the iPhone music library to display, the user selects a song, then this song title is reflected in a UILabel. If only it was that simple! I have tried getting the MPMediaItem into a NSString then the UILabel reflecting this, but i’m just getting (null) returned!

- (IBAction)showMediaPicker:(id)sender {
    MPMediaPickerController *mediaPicker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAny];

    mediaPicker.delegate = self;
    //mediaPicker.allowsPickingMultipleItems = YES;
    mediaPicker.prompt = @"Select Your Favourite Song!";

    [self presentModalViewController:mediaPicker animated:YES];
}

- (void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItem *) mediaItemCollection {

    NSString *titleString = [mediaItemCollection valueForProperty:MPMediaItemPropertyTitle];
    titleLabel.text = [NSString stringWithFormat:@"Title: %@",titleString];


    [self dismissModalViewControllerAnimated: YES];
}

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-17T14:17:52+00:00Added an answer on June 17, 2026 at 2:17 pm

    You’re trying to grab the title for a mediaItemCollection. You need to get the individual song title like this:

    MPMediaItem *selectedSong = [mediaItemCollection items] objectAtIndex:0];
    NSString *titleString = [selectedSong valueForProperty:MPMediaItemPropertyTitle];
    

    Also by the way, you have the wrong delegate setup for your MPMediaPickerControllerDelegate:

    It should be:

    - (void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
    

    -You have the MPMediaItemCollection as just an MPMediaItem

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

Sidebar

Related Questions

I am new to iPhone programming. I want to get the height and width
I'm new in iPhone Application Programming. I can't get value from XML file and
I have a (hopefully silly) iPhone programming question. I'm trying to get a string
I have followed the tutorial: www.edumobile.org/iphone/iphone-programming-tutorials/a-simple-stopwatch-for-iphone and I get 1 error and 1 warning,
I am using this http://imthi.com/blog/programming/iphone-rss-reader-application-with-source-code.php as a start for my rss reader in my
Programming an iPhone App, I need to use Google Maps api to get directions
I'm new to iOS programming and I'm reading this tutorial to get along http://www.raywenderlich.com/1797/how-to-create-a-simple-iphone-app-tutorial-part-1
I'm quite new to developing on the Mac, I've only done iPhone programming until
I'm using this code: http://imthi.com/blog/programming/iphone-sdk-convert-hex-color-string-to-uicolor.php But i'm unsure as to how to get it
i'm new to iPhone programming and web service too. I'm trying to get a

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.