iOS 5 onwards, MPNowPlayingInfoCenter supports the setting of the track title as well as album art image in both the lock screen and the remote playback controls.
To check whether MPNowPlayingInfoCenter
is available, try this:-
if ([MPNowPlayingInfoCenter class]) {
UIImage *albumArtImg = [UIImage imageNamed:@"abc.png"];
albumArt = [[MPMediaItemArtwork alloc] initWithImage:albumArtImg];
NSDictionary *dictCurrentlyPlaying = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"Temporary", [NSNumber numberWithInt:22], albumArt, nil] forKeys:[NSArray arrayWithObjects:MPMediaItemPropertyTitle, MPMediaItemPropertyPlaybackDuration, MPMediaItemPropertyArtwork, nil]];
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = dictCurrentlyPlaying;
}
Updated:-
Please have a look at these:-
1. http://jaysonlane.net/tech-blog/2012/04/lock-screen-now-playing-with-mpnowplayinginfocenter/
2. How to set the title when playing music in background on iPhone?