I am trying to play a sound when I click a button, the sound clip is 10 sec, the application runs fine and when I click the button nothing happens there are no errors or nothing, this is my code
.m file
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
- (IBAction)Play:(id)sender {
AVAudioPlayer *audioPlayer;
NSString *audioPath = [[NSBundle mainBundle]pathForResource:@"Blesgaes" ofType:@"mp3"];
NSURL *audioURL =[NSURL fileURLWithPath:audioPath];
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioURL error:nil];
[audioPlayer play];
}
.h file
#import <AVFoundation/AVFoundation.h>
@interface ViewController : UIViewController
- (IBAction)Play:(id)sender;
I have added AVFoundation framework and I have followed these steps
http://looksok.wordpress.com/2013/01/19/ios-tutorial-play-sound/ http://www.techotopia.com/index.php/Playing_Audio_on_an_iPhone_using_AVAudioPlayer_(iOS_6) http://code-and-coffee.blogspot.in/2012/09/how-to-play-audio-in-ios.html
Any ideas what I am doing wrong.