iPhone获取所有专辑/艺术家 [英] iPhone get all albums/artists

查看:94
本文介绍了iPhone获取所有专辑/艺术家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们是否有关于如何从iPod媒体库中检索所有音乐专辑或艺术家的示例代码(或其链接)?



提前致谢使用MPMediaQuery:

  MPMediaQuery * allAlbumsQuery = [MPMediaQuery albumsQuery]; 
NSArray * allAlbumsArray = [allAlbumsQuery collections];

allItems数组现在包含MPMediaItemCollections,分组由专辑完成。现在您可以浏览阵列了。

  for(MPMediaItemCollection * collection in allAlbumsArray){
MPMediaItem * item = [collection representativeItem];
}


does any of you have example code (or a link to it) of how to retrieve all music albums or artist from the iPod media library?

Thanks in advance!

解决方案

Use a MPMediaQuery:

MPMediaQuery *allAlbumsQuery = [MPMediaQuery albumsQuery];
NSArray *allAlbumsArray = [allAlbumsQuery collections];

The allItems array does now contain MPMediaItemCollections, grouping is done by album. Now you can walk through the arrays.

for (MPMediaItemCollection *collection in allAlbumsArray) {
    MPMediaItem *item = [collection representativeItem];
}

这篇关于iPhone获取所有专辑/艺术家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆