Playing sounds in iPhone SDK can be realized in many ways. This solution shows how to play short sounds using SystemSoundID class and can be taken into consideration when playing sounds f.e in menu of your application.
Before we start writing code we should add AudioToolbox framework to our project.
Now the code part. First of all we have to import AudioServices.h to our project.
#import <AudioToolbox/AudioServices.h>
Than we can create a container for our sounds. It can be either an array of SystemSoundIDs, NSMutableArray or a single SystemSoundId object.
SystemSoundID sounds[10];
Now we have to initialize our sound. To do so in init or viewDidLoad etc. :
//Path for our sound: NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"my-sound" ofType:@"wav"]; CFURLRef soundURL = (__bridge CFURLRef)[NSURL fileURLWithPath:soundPath]; AudioServicesCreateSystemSoundID(soundURL, &sounds[0]);
To play it:
AudioServicesPlaySystemSound(sounds[0]);


This post was somewhat helpful but needs to be updated for XCode 4.2 as that nice Add.. Existing Frameworks… option was removed.
it still is, but it was moved.
> select targed > build phases > link with libraries > add > select > done.
I get a invalid cast on the line:
CFURLRef soundURL = (CFURLRef)[NSURL fileURLWithPath:soundPath];
using: soundURL = (__bridge CFURLRef)[NSURL fileURLWithPath:soundPath];
1) does the import statement go in the .m or .h file?
2) Where do I put the .wav file?