how can i play a song file bundled with the application using MPMusicPlayerController ?
code that i tried,
NSString *url = [[NSBundle mainBundle] pathForResource:@"song1" ofType:@"mp3"];
MPMusicPlayerController *myMusicPlayer=[[MPMusicPlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]];
[myMusicPlayer play];
MPMusicPlayercontroller is only for playing items from the user’s iPod library. TheAVAudioPlayerwill play encoded files from your app’s sandbox, and you should be able to convert this code to useAVAudioPlayereasily enough… looks like it would be: