Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMusicPlayerController deprecated with iOS 6

I've just seen iOS 5.1 to iOS 6.0 API Differences released by Apple. They say that some important methods of MPMusicPlayerController.h are removed to MPMediaPlayback protocol (play, pause, stop...).

Does somebody know how to update my application who use the code below to work with the iOS 6?

MPMusicPlayerController *musicPlayer = [MPMusicPlayerController iPodMusicPlayer];
musicPlayer play;
like image 860
Vincent Cotro Avatar asked Jun 12 '12 14:06

Vincent Cotro


1 Answers

The MPMusicPlayerController class conforms to the MPMediaPlayback protocol, and calling [MPMusicPlayerController iPodMusicPlayer] returns an instance of MPMusicPlayerController. Moreover, all the deprecated methods that were removed from the MPMusicPlayerController class are present in the MPMediaPlayback protocol. What this means is that:

  1. No changes should be required for your code to work under iOS 6. The play method still exists for every MPMusicPlayerController instance, and calling it should do the same thing that it always has.

  2. No methods have actually been "removed". They were moved into a protocol, presumably because having an abstraction of a media player API allows for very cool things to be done by providing custom object implementations that conform to the MPMediaPlayback protocol.

like image 76
aroth Avatar answered Oct 04 '22 17:10

aroth