iPhone sdk - accessing current song information through an app

后端 未结 2 1243
难免孤独
难免孤独 2020-12-17 21:49

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?

2条回答
  •  抹茶落季
    2020-12-17 22:28

    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.

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

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

提交回复
热议问题