目前我嘗試這種代碼播放單WAV:iPhone SDK:從一個按鈕
NSString *path = [[NSBundle mainBundle] pathForResource:@"dream" ofType:@"m4a"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
然而,SDK說,視圖控制器沒有實現AVAudioPlayer代表。
任何有關如何使用2.2 SDK播放WAV(或M4a)的任何想法?
不要忘記將AudioToolbox和AVFoundation框架添加到您的項目中,並在視圖控制器委託文件中導入和。 –
Joseph
2011-06-14 16:02:10