views:

9

answers:

0

I put my avfoundation into frameworks by adding existing frameworks and importing it into my viewcontroller like this #import <AVFoundation/AVAudioPlayer.h>

I then called it in my IBAction so when a button pressed it, it plays like so.

-(IBAction)playSound{ //play the cricket noise

NSString *path = [[NSBundle mainBundle] pathForResource:@"Cricked_Sound" ofType:@"mp3"];

audioPlayer =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];

audioPlayer.delegate = self;

[audioPlayer play];

}

But it crashes when ran, and it gives this warning.

/Programming/Obj-C Programs/iPhone/Awkward Cricket/Classes/Awkward_CricketViewController.m:42:0 /Programming/Obj-C Programs/iPhone/Awkward Cricket/Classes/Awkward_CricketViewController.m:42: warning: class 'Awkward_CricketViewController' does not implement the 'AVAudioPlayerDelegate' protocol