这段代码:
NSString *urlPath = [[NSBundle mainBundle] pathForResource:@"snd" ofType:@"mp3"];
NSURL *url = [NSURL fileURLWithPath:urlPath];
NSError *err;
AVAudioPlayer* audioPlayerMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&err];
[audioPlayerMusic play];
工作得很好。
虽然这个:
NSString *urlPath = [[NSBundle mainBundle] pathForResource:@"snd" ofType:@"mp3"];
NSURL *url = [NSURL fileURLWithPath:urlPath];
AVPlayer* audioPlayerMusic = [AVPlayer playerWithURL:url];
[audioPlayerMusic play];
什么都不玩!
怎么了?