如何检查ipod是否有音乐文件

发布于 2024-09-25 14:51:08 字数 132 浏览 0 评论 0原文

我正在尝试让我的应用程序使用 MPMusicPlayerController 从 iPod 播放音乐,但有些设备的 iPod 库中没有音乐。谁能告诉我是否有办法在初始化 iPod 播放器之前检查 iPod 库中是否有音乐。

提前致谢。

I am trying to have my app play music from ipod using MPMusicPlayerController but there are devices which do not have music in there ipod library. Can anyone tell me if there is a way to check whether there is music in the ipod library or not before initializing the ipod player.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初心 2024-10-02 14:51:08
if ([[[MPMediaQuery songsQuery] items] count] > 0) {
    // The user has songs in his or her library.
}
if ([[[MPMediaQuery songsQuery] items] count] > 0) {
    // The user has songs in his or her library.
}
青芜 2024-10-02 14:51:08

MPMediaQuery *查询 = [MPMediaQueryongsQuery];
NSArray *collections = [查询集合];

MPMediaQuery *query = [MPMediaQuery songsQuery];
NSArray *collections = [query collections];

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文