hi all i have been trying to create a soundboard for some time and i found this site is there anyone out there that can answer this question by putting up a fully working code for iPhone Xcode 4.2 thank you for your time.
heres my code but it has errors
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
-(IBAction)sound1 {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"sound1", CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
plus someone said to use av something please edit or upload code When answering I’m a beginner lol
I just tested the code you posted and it works very well as is – no errors here.
So you probably forgot to do one (or more) of the following things:
AudioToolboxframework into your project#import <AudioToolbox/AudioToolbox.h>;in your ViewController.m file