Problem with playing a sound when a button is clicked.
- by iSharreth
in my code:
import "MyViewController.h"
import
(IBAction)playSound{
AVAudioPlayer *myExampleSound;
NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"myaudiofile" ofType:@"caf"];
myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL];
myExampleSound.delegate = self;
[myExampleSound play];
}
But it is showing a warning that Class MyViewController does not implement AVAudioplayerDelegate.
Anyone please help. I had included the AVFoundation.Framework.