我正在使用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];
}
内存泄漏,应用程序崩溃,我想立即分配播放器并一次又一次地使用它。