I am writing small app that can play music. To get all songs I am using code below
var songsArray: [MPMediaItem] = [MPMediaItem]()
var mediaQuery = MPMediaQuery()
songsArray = MPMediaQuery.songsQuery().items as [MPMediaItem]
for songItem in songsArray {
var song: myMusicItem? = myMusicItem(songTitle: songItem.title, songAlbum: songItem.albumTitle, songArtist: songItem.albumArtist, songGenre: songItem.genre)
retArray.append(song!)
}
println(String(format:"Number of songs:\t%i", retArray.count))
And the problem is that retArray
has more items than actually is in my library. Does anyone have an idea why this situation is happening?