Sometimes a user might want to substitute a musical track from his or her personal collection into the background of your game. In this example, we will create a simple music player that can load songs, albums, and playlists from the iPod music library on the device.
Link the MediaPlayer
framework to your project. Now, execute the following code:
#import <MediaPlayer/MediaPlayer.h> #import "AppDelegate.h" @interface Ch6_iPodLibrary : Recipe <MPMediaPickerControllerDelegate> { /* CODE OMITTED */ } @implementation Ch6_iPodLibrary -(CCLayer*) runRecipe { //Device detection NSString *model = [[UIDevice currentDevice] model]; //Show a blank recipe if we use the simulator if([model isEqualToString:@"iPhone Simulator"]){ message.position = ccp(240,250); [self showMessage:@"This recipe is not compatible with the Simulator. \nPlease...