This is a piece of sample code I am using:
1st option:
I defined this in my .h file
SystemSoundID topClick;
And in my .m file I firest load the sound (aiff file):
NSBundle* bundle = [NSBundle mainBundle];
NSString *topClickFile = [bundle pathForResource:@"top_click" ofType:@"aiff"];
Then, when I want to play the sound, I use:
AudioServicesPlaySystemSound(topClick);
2nd option:
You could also use the AVAudioPlayer (available since firmware 2.2 I think):
NSString *graffitiSprayFile = [bundle pathForResource:@"sound_effect" ofType:@"aiff"];
AVAudioPlayer* sprayAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:graffitiSprayFile] error:NULL];
sprayAudio.delegate = self;
[sprayAudio prepareToPlay];
[sprayAudio setNumberOfLoops:999];
The first option is very usable for relatively short sound effect.