iosswiftmpmediaitemmpmediaquery

Cannot understand behavior of MPMediaQuery


I was working with MPMediaItem. I used MPMediaQuery.songsQuery() to fetch the songs based on their titles. The problem is that I saw some songs out of order.

The songs names were always starting with "the"

For example, if the song name was "the brave new world", it would disregard "the" and then sort.

Then I checked with the Music Player app on iphone. It was returning same results. Here is a screenshot.

enter image description here

Notice that "the best of me" is in the index starting with "b".

So does MPMediaQuery ignores "the"?

Why is that and how to get rid of it?


Solution

  • Yes, this is by design. Tracks and artists starting with the word "the" are alphabetized by their second word. There is no way to change this behavior.