For playing quick sounds I prefer SystemSound over AudioPlayer because load time is quicker. But now I have upgraded to Xcode 4.5.2 and using ARC my code to play audio snippets no longer works. See full code below. The error I get is from the following line: AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID); I get red error with the following error message : Cast of Objective type NSURL to C pointer type CFURL (aka const dtruct). Any ideas how could replace this line ??`
NSString *path = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"/click.mp3"];
SystemSoundID soundID;
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
// here is the problem line
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
AudioServicesPlaySystemSound(soundID);
With ARC, you need to use __bridge for toll free bridging between Foundation and Core Foundation.
Try this: