In my app I have a timer that counts down, and when it stops an image is displayed and a sound is played.
The sound is loaded like this:
NSString *path = [[NSBundle mainBundle] pathForResource:@"scream" ofType:@"wav"]; AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID);
And Played like this on timer end:
AudioServicesPlaySystemSound(soundID);
My problem is that the sound doesn't get played on time. Even though the sound instance is called before the image, the image appears before the sound. This only occurs the first time the sound is played. The sound is loaded in the viewDidLoad method.
Is there a better way to do it, or what am I doing wrong?
Thanks...