Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone, get playlists from Cocoa Touch

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

like image 870
Sergey Zenchenko Avatar asked Dec 05 '22 03:12

Sergey Zenchenko


1 Answers

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);
    }
}
like image 159
www.ruu.cc Avatar answered Dec 20 '22 04:12

www.ruu.cc