NSString *path = [[NSBundle mainBundle] pathForResource:@"hit-pipe" ofType:@"wav"];
audioPlayer =[[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];
[self.audioPlayer setDelegate:self];
[self.audioPlayer prepareToPlay];
[self.audioPlayer play];
第一次加載聲音需要時間。第一次加載時AVAudio Player被延遲
檢查[this](http://stackoverflow.com/questions/900461/slow-start-for-avaudioplayer-the-first-time-a-sound-is-played)回答延遲。解決方案是[this](http://stackoverflow.com/questions/5684374/trying-to-fix-avaudioplayer-lag-on-its-initial-use)和[this](http://stackoverflow.com/questions/2550480 /延遲播放聲音使用avaudioplayer)鏈接。得到幫助 – 2012-08-13 06:29:42