AVAudioPlayer, kein Ton
Ich habe Audio-Toolbox und avfoundation in meine Klasse importiert und die Frameworks zu meinem Projekt hinzugefügt und benutze diesen Code, um einen Sound abzuspielen:
- (void)playSound:(NSString *)name withExtension:(NSString *)extension
{
NSURL* soundUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:name ofType:extension]];
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:nil];
audioPlayer.delegate = self;
audioPlayer.volume = 1.0;
[audioPlayer play];
}
Ich nenne es so:
[self playSound:@"wrong" withExtension:@"wav"];
Kein Ton. Jede Hilfe wird sehr geschätzt, danke.