Read the documentation: MPNowPlayingInfoCenter
And here is an example code that will work on iOS 5 and it will not crash on older versions of iOS.
Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if (playingInfoCenter) {
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
NSDictionary *songInfo = [NSDictionary dictionaryWithObjectsAndKeys:
@"Some artist", MPMediaItemPropertyArtist,
@"Some title", MPMediaItemPropertyTitle,
@"Some Album", MPMediaItemPropertyAlbumTitle,
nil];
center.nowPlayingInfo = songInfo;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…