I was wondering what was the best way to play audio at the beginning of the app, without having any build errors or warnings.
The way I approached it works, but gives me a warning.
Quote:
|
warning: class 'SoundAudioVewController' does not implement the 'AVAudioPlayerDelegate' protocol
|
So I imported the AV Foundation Framework into my project called "SoundAudio." In my SoundAudioViewController.m I entered the following code:
Code:
@implementation SoundAudioViewController
- (void)awakeFromNib {
NSString *path = [[NSBundle mainBundle] pathForResource:@"startApp" ofType:@"wav"];
AVAudioPlayer* theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path]error:NULL];
theAudio.delegate = self;
[theAudio play];
}
Is there a better way? Thanks!