I'm trying to get a sound to play but when I code:
AudioServicesCreateSystemSoundID ((CFURLRef) alertSound, &soundFileObject);
it throws the following error:
Cast of Objective-C pointer type 'NSURL *' to C pointer type 'CFURLRef' (aka 'const struct __CFURL *') requires a bridged cast error
I have tried both of the two following suggested solutions:
AudioServicesCreateSystemSoundID ((__bridge CFURLRef) alertSound, &soundFileObject);
or
AudioServicesCreateSystemSoundID ((CFURLRef) CFBridgingRetain(alertSound), &soundFileObject);
But I still can't get the sound to play.
I guess the question is: is the bridging error the cause of the sound not playing, or should I be looking else where?
I can get the sound to play using the SysSound sample code and I'm using iOS 6 and Xcode 4.5.
Thanks for any pointers :)