1 2 NSError *playerError; 3 4 player = [[AVAudioPlayer alloc] initWithContentsOfURL:recordedFile error:&playerError]; 5 6 7 //在前面加上 8 AVAudioSession *audioSession = [AVAudioSession sharedInstance]; 9 NSError *err = nil; 10 [audioSession setCategory :AVAudioSessionCategoryPlayback error:&err]; 11 //弄好了,在播放前这样就可以了