I am trying to grab the current playing sone on iOS 5 and dump the artist and title into a UILabel. Is this possible?
As far as I was aware on previous versions of the OS I would use;
MPMediaPlayer* player = [MPMediaPlayer iPodMusicPlayer];
//get now playing item
MPMediaItem*item = [player nowPlayingItem];
// get the title of song
NSString* titleStr = [item valueForProperty:MPMediaItemPropertyTitle];
But this produces some warnings and does not work. Any help would be appreciated
Thanks
I tried to compile your code, and it looks like you’re using the wrong class. You want MPMusicPlayerController, instead of MPMediaPlayer.
This compiles without warnings, I haven’t tested it on a device, but this should help.