0

At first, I want to say that i don't speak English very well. understand please TT

I typed the code in Xcode.

MPMediaQuery* songsQuery = [MPMediaQuery songsQuery];

self.songsSectionArray = [songsQuery collectionSections];

In the songsQuery, There are many songs starting with A-Z, And the other songs.

And, I used 'collectionSections ' method

And than, I logged using NSLog. To check in songsSectionArray

It was normally outputted. It has no problem

But, I copied the code, and pasted.

And logged.

Then, It has problem T.T

The result was different

This is normal output :

title=A
title=B
title=C
title=D
title=E
title=F
title=G
title=H
title=I
title=J
title=K
title=L
title=M
title=N
title=O
title=P
title=R
title=S
title=T
title=U
title=V
title=W
title=Y
title=#

And this is the output that I copied code :

title=B
title=K
title=O
title=P
title=Q
title=R
title=S
title=T
title=U
title=V
title=W
title=X
title=Y
title=Z
title=#
title=#
title=#
title=#
title=#
title=#

Code is clearly the same. But why the output is different?

Please help me if you know a solution

2 Answers2

0

The collectionSections array returns an array of MPMediaQuerySections representing section titles relative to the section grouping of the media item collections. These section titles group everything by the first letter of the media item. In this case, songsQuery is used, so each section title is relative to the first letter of each song.

The issue here is that you don't have songs stored on the device that start with every letter of the alphabet. You won't see sections for certain letters due to nonexistent songs.

For example, if there are no songs on the device that begin with the letter "D", there will be no section for "D", and you will not see any section output for the letter "D" in your log statement.

Bryan Luby
  • 2,527
  • 22
  • 31
0

Add at least one localized file(e.g. InfoPlist.strings for Japanese).

In my situation, the project only had Base and English localization causes the same problem.

ka2n
  • 391
  • 3
  • 10