解决方法
阅读文档:
MPNowPlayingInfoCenter
这里是一个可以在iOS 5上运行的示例代码,它不会在旧版本的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; }