views:

125

answers:

2

How i can get list of user playlists from code? In CocoaTouch.

+3  A: 

This is solution:

MPMediaQuery *playlistsQuery = [MPMediaQuery playlistsQuery];
NSArray *playlists = [playlistsQuery collections];

:)

Sergey Zenchenko
A: 

MPMediaQuery *myPlaylistsQuery = [MPMediaQuery playlistsQuery];

NSArray *playlists = [myPlaylistsQuery collections];

for (MPMediaPlaylist *playlist in playlists) { NSLog (@"%@", [playlist valueForProperty: MPMediaPlaylistPropertyName]); NSArray *songs = [playlist items]; for (MPMediaItem *song in songs) { NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle]; NSLog (@"\t\t%@", songTitle); } }

www.ruu.cc