I try to play a sound, but when I code:
AudioServicesCreateSystemSoundID ((CFURLRef) alertSound, &soundFileObject);
it produces the following error:
Entering the Objective-C type of the pointer type 'NSURL *' into the C type of the 'CFURLRef' type (aka 'const struct __CFURL *') requires a bridge error
I tried both of the following suggested solutions:
AudioServicesCreateSystemSoundID ((__bridge CFURLRef) alertSound, &soundFileObject);
or
AudioServicesCreateSystemSoundID ((CFURLRef) CFBridgingRetain(alertSound), &soundFileObject);
But I still can not reproduce the sound.
I guess the question is, is a bridge error causing an unplayable sound, or should I look elsewhere?
I can play the sound using the SysSound example code, and I use iOS 6 and Xcode 4.5.
Thanks for any pointers :)
source
share