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;
The
MPMusicPlayerControllerclass conforms to theMPMediaPlaybackprotocol, and calling[MPMusicPlayerController iPodMusicPlayer]returns an instance ofMPMusicPlayerController. Moreover, all the deprecated methods that were removed from theMPMusicPlayerControllerclass are present in theMPMediaPlaybackprotocol. What this means is that:No changes should be required for your code to work under iOS 6. The
playmethod still exists for everyMPMusicPlayerControllerinstance, and calling it should do the same thing that it always has.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
MPMediaPlaybackprotocol.