- (void)playVoice:(NSString*) voice type:(NSString*)type{
NSURL* url = [NSURLfileURLWithPath:[[NSBundlemainBundle]pathForResource:voiceofType:type]];
AVAudioPlayer* player = [[AVAudioPlayeralloc]initWithContentsOfURL:urlerror:nil];
player.volume=0.8;
[playerplay];
//_player = player; //第一種 使用全局變量保存 ,有聲音 ?
//[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; //第二種沒有聲音姻报,別的帖子上說可以解決甫菠,但是我試的時(shí)候還是沒有聲音
//sleep(2); //第三種裸扶,有聲音
}