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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:52:40+00:00 2026-06-18T10:52:40+00:00

How can I search the iPod Library in the same manner as the iOS

  • 0

How can I search the iPod Library in the same manner as the iOS Music application? I want to make general queries that return results for each Artists, Albums, and Songs. For instance, if I search Kenny Chesney I want the songs query to return all Kenny Chesney songs (and any songs titles or albums that contain Kenny Chesney in them.) When I make this query and a predicate for each property (song title, album title, artist name), an empty array returns.

Here is a bit of code that may give you a better idea of what I am attempting to accomplish:

MPMediaPropertyPredicate *songPredicate =
[MPMediaPropertyPredicate predicateWithValue:searchText
                                 forProperty:MPMediaItemPropertyTitle
                              comparisonType:MPMediaPredicateComparisonContains];

MPMediaPropertyPredicate *albumPredicate =
[MPMediaPropertyPredicate predicateWithValue:searchText
                                 forProperty:MPMediaItemPropertyAlbumTitle
                              comparisonType:MPMediaPredicateComparisonContains];

MPMediaPropertyPredicate *artistPredicate =
[MPMediaPropertyPredicate predicateWithValue:searchText
                                 forProperty:MPMediaItemPropertyArtist
                              comparisonType:MPMediaPredicateComparisonContains];

MPMediaQuery *songsQuery = [MPMediaQuery songsQuery];
[songsQuery addFilterPredicate:songNamePredicate];
[songsQuery addFilterPredicate:artistNamePredicate];
[songsQuery addFilterPredicate:albumNamePredicate];

NSLog(@"%@", [songsQuery items]);

I have this working by running the query with each predicate separately but this seems very inefficient!

  • 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-18T10:52:41+00:00Added an answer on June 18, 2026 at 10:52 am

    Combining your predicates this way makes it like “AND” relationship. It means that you are querying for a song that has title, album and name all are matching the search text.

    To achive what you are trying to do, you should run 3 queries and combining the results in a proper way.

    If you run:

    MPMediaPropertyPredicate *artistPredicate =
    [MPMediaPropertyPredicate predicateWithValue:searchText
                                     forProperty:MPMediaItemPropertyArtist
                                  comparisonType:MPMediaPredicateComparisonContains];
    
    NSSet *predicates = [NSSet setWithObjects: artistPredicate, nil];
    
    MPMediaQuery *songsQuery =  [[MPMediaQuery alloc] initWithFilterPredicates: predicates];
    
    NSLog(@"%@", [songsQuery items]);
    

    This will return you with artists matching your search.
    The same you should do for songs and albums.

    If you this this is slow, you may retrieve all the media at once and filter it manually:

    MPMediaQuery *everything = [[MPMediaQuery alloc] init];
    
    NSLog(@"Logging items from a generic query...");
    NSArray *itemsFromGenericQuery = [everything items];
    for (MPMediaItem *song in itemsFromGenericQuery) {
        NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle];
        /* Filter found songs here manually */
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a php code that can search for multiple keywords separated
I want to make a search box, where you can search between records in
I'm developing an application where users can search for other users that are already
I'm aware that I can search queries by calling where() on a model as
My application shows several items whereby users can search. I want to place a
Can anybody tell me how to search for available iPhone/iPod devices on a network
I'm writing a library search engine where a user can search based on various
I have a search form that can search in different provider. I started out
in SO you can search for tags without pressing enter. i want to know:
Hello is there anyway that I can search my Excel Document in a certain

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.