views:

146

answers:

1

I have an Album object containing a MPMediaItemCollection of the album's tracks.

When I add this collecton to the queue with the following line of code, only the first track gets added.

[iPodMusicPlayer setQueueWithItemCollection:album.mediaItems];

Oddly enough when I add with the following line of code, everything works as expected.

[iPodMusicPlayer setQueueWithItemCollection:[MPMediaItemCollection collectionWithItems:[album.mediaItems items]]];

Why would the second line work but not the first?

A: 

The MPMediaItemCollection Class Reference makes no mention of a mediaItems property. I'd guess the property you're accessing is similar to representativeItem, as that would explain why you'd only get the first track.

It looks like you answered your own question. You should use:

[MPMediaItemCollection collectionWithItems:[album items]]

David Patierno