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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:08:17+00:00 2026-05-27T19:08:17+00:00

The following code, is used to partition and add sections to a list of

  • 0

The following code, is used to partition and add sections to a list of songs.

    query = [MPMediaQuery songsQuery];
    [query addFilterPredicate: artistNamePredicate];            
    NSArray *itemsFromArtistQuery = [query items];  
    self.artist1 = [self partitionObjects:itemsFromArtistQuery collationStringSelector:@selector(title)];

Works perfectly. However when I try to do it with:

    query = [MPMediaQuery albumsQuery]; //same with playlistsQuery, artistsQuery, genresQuery
    [query addFilterPredicate: artistNamePredicate];            
    NSArray *itemsFromArtistQuery = [query collections];    
    self.artist1 = [self partitionObjects:itemsFromArtistQuery collationStringSelector:@selector(title)];

I get a SIGABRT error every single time. I’ve attributed it to the “collections” part of the code, as that’s the only difference in the whole block. I’ve tried changing “title” to “name” “albumTitle”, “playlist”, “genre” and more, but I still end up with:

"-[MPConcreteMediaItemCollection title]: unrecognized selector sent to instance"

Can anybody help me here? I’m ready to rip my hair out!

THANK-YOU!

BenBen

  • 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-05-27T19:08:17+00:00Added an answer on May 27, 2026 at 7:08 pm

    You are right that the problem is with the collections part. The collationStringSelector: must be a method that returns a NSString for the objects your passing it, in this case MPMediaItemCollection‘s.

    (It worked in the first case because you were passing MPMediaItem‘s which do respond to title).

    Here we select each MPMediaItemCollection from the artistCollections array and then get a single MPMediaItem that represents the whole collection. We can then get the artists name and add it to an array.

    query = [MPMediaQuery albumsQuery]; //same with playlistsQuery, artistsQuery, genresQuery
    [query addFilterPredicate: artistNamePredicate];            
    NSArray *artistCollections = [query collections];
    NSMutableArray *artists = [NSMutableArray array];
    
    for (MPMediaItemCollection *artist in artistCollections) {
        // get a single MPMediaItem that represents the collection
        MPMediaItem *representativeItem = [artist representativeItem];
        NSString *artistName = [representativeItem valueForProperty:MPMediaItemPropertyArtist];
        [artists addObject:artistName];
    }
    
    self.artist1 = [self partitionObjects:artists collationStringSelector:@selector(self)];
    

    Now we are passing an array of NSString‘s so we set the collationStringSelector: to self which will return the artists name as a NSString.

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

Sidebar

Related Questions

I try add an event to blackberry calendar. The following code is used: EventList
I swear the following code used to work, even in IE7 but now i
The following code is used to fetch logs from app engine for further processing.
here the following code is used to view the present modal view controller. [[self
Consider the following php code used for HTML output: echo <div id='logo2'> <a href='if(checkLanguage())
i have used following code to repeat a process creation/close iteratively dim vProcessInfo as
I have used following code to create a simple PDF file. It executes fine
The following code is being used to disable a Submit button once it has
I've used following code snippet for my activity in order to deal with orientation
I've used following code for parsing XML file in c++. http://www.codeproject.com/Articles/176236/Parsing-an-XML-file-in-a-C-C-program . Now I

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.