This is my code right now. I am trying to add sound effects when a button is pressed.
#import <AudioToolbox/AudioToolbox.h>
- (void)threeBombExplosion
{
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"3Explosions" ofType:@"mp3"];
NSURL *threeExplosionsURL = [NSURL fileURLWithPath:soundPath];
AudioServicesCreateSystemSoundID(CFBridgingRetain(threeExplosionsURL),&_threeExplosionsID);
}
and I am calling this on the function I want it to be executed (UIButton Action).
AudioServicesPlaySystemSound(_threeExplosionsID);