System Sounds
You can play a short sound file (wav) that is 30 seconds or less using a System Sound.
Step 1: Add the AudioToolbox.framework
Click on your project in the left pane of Xcode
Click on your TARGETS and then click on Build Phases
Click on Link Binary With Libraries and click on the + icon
Now choose the AudioToolbox.framework
Step 2: Add
#import < AudioToolbox/AudioToolbox.h > to your controller's .h file
Step 3: Add
SystemSoundID theSound; as an instance variable in your .h file
Step 4: Copy
your sound files to your project (30 seconds or less wav files)
Step 5: Register your sound (30 seconds or less wav files)
NSURL *theSoundURLRef = [[NSBundle mainBundle] URLForResource:@"filename"
withExtension:@"wav"];
SystemSoundID theSoundID = 0;
AudioServicesCreateSystemSoundID((CFURLRef) theSoundURLRef,&theSoundID);
theSound = theSoundID;
Step 6: To Play the Sound
AudioServicesPlaySystemSound(theSound);