我正在使用AVAudioPlayer和我聲音再次和安吉爾,並在我的應用程序調用此方法100次。問題是,我總是孤獨,但當我要去釋放,聲音不起作用。 我該怎麼辦。AVAudioPlayer泄漏和警告,並在最後我的應用程序崩潰
-(void) ButtonSound
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Button1"
ofType:@"mp3"];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:nil];
[player play];
[fileURL release];
}
內存泄漏,應用程序崩潰,我想立即分配播放器並一次又一次地使用它。