You are correct, MPNowPlayingInfoCenter
is the only way to do this. So go ahead and link with MediaPlayer.framework
. In the class that handles playing tracks, import <MediaPlayer/MediaPlayer.h>
. Whenever your track changes, do this:
NSDictionary *info = @{ MPMediaItemPropertyArtist: artistName,
MPMediaItemPropertyAlbumTitle: albumName,
MPMediaItemPropertyTitle: songName };
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = info;