不會打我使用播放聲音的代碼是這樣的:聲音在按下按鈕
NSString *soundFilePath = [NSString stringWithFormat:@"%@/%@.m4a", [[NSBundle mainBundle] resourcePath],currentSound.soundNameID];
NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];
player.numberOfLoops = 0;
[player play];
我想播放聲音,但它不會玩。我的文件是m4a
類型。
你能播放其他聲音文件嗎?你可以打印你的soundFileURL。 – Divyu