Possible Duplicate:
iOS: Updating Media Information in the Background
I have an application that streams music from a server, I want to show the information of the now playing music when the user lock the iPhone screen actually I have found this code online:
Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if (playingInfoCenter) {
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
NSDictionary *songInfo = [NSDictionary dictionaryWithObjectsAndKeys:
@"Artist", MPMediaItemPropertyArtist,
@"Title", MPMediaItemPropertyTitle,
@"AlbumTitle", MPMediaItemPropertyAlbumTitle,
nil];
center.nowPlayingInfo = songInfo;
}
But I don't know where to inject this code I tried to put it inside the IBAction method which is linked to the play button but it didn't work. Is there any one can help me with that ? please. Thanks in advance.