iPhone sdk - 通过应用程序访问当前歌曲信息 [英] iPhone sdk - accessing current song information through an app

查看:100
本文介绍了iPhone sdk - 通过应用程序访问当前歌曲信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以检索有关当前正在播放的歌曲的信息。我想获得艺术家和标题,然后我可以在应用程序上显示这个?

Is it possible to retrieve the info about the current song being played. I'm looking to get the artist and title so I can then display this on an app?

推荐答案

随着公众可用的iPhone API(对于OS< = 2.2.1),无法从设备上的iTunes库收集任何信息。它可以使用非官方方法完成,但是,这样的方法会导致Apple拒绝您的应用程序。

With the publicaly available iPhone API (for OS <= 2.2.1), it is not possible to gather any information from the iTunes library on the device. It can be done using unofficial methods, however, such methods would result in Apple declining your application.

使用iPhone OS 3.0 API,您可以使用以下内容:

With the iPhone OS 3.0 API, you can use something like the following:

MPMediaItem *nowPlayingMediaItem = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];

这篇关于iPhone sdk - 通过应用程序访问当前歌曲信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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