Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sclaxplayer

macrumors newbie
Original poster
I recently have been experimenting with the use of sounds in my programming and I have been using the AVFoundation Library. I have it right now in a way that I implemented my own MainView class and when a button is pushed it would call the function PushButtton. Here is my entire MainView.m implementation. and the audio clip is named Foreward.m4a

#import "AVFoundation/AVAudioPlayer.h"

@implementation MainView
- (IBAction)PushButton {

NSString *soundFilePath = [[NSBundle mainBundle] pathForResource: @"Foreward" ofType: @"m4a"];
AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:soundFilePath] error: nil];
newPlayer.delegate = self;
[newPlayer play];

}

I can't get this Foreward.m4a to play. When i run this my iPhone sim to freeze up and terminates due to an uncaught exception. Any suggestions?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.