A minor change is needed to the “Playing a System Sound” code snippet.
A __bridge
modifier has to be added to the CFURLRef
cast.
// Required import... Also need AudioToolbox.framework #import <AudioToolbox/AudioToolbox.h> // ivar SystemSoundID mBeep; // Create the sound ID NSString* path = [[NSBundle mainBundle] pathForResource:@"Beep" ofType:@"aiff"]; NSURL* url = [NSURL fileURLWithPath:path]; AudioServicesCreateSystemSoundID((__bridge CFURLRef)url, &mBeep); // Play the sound AudioServicesPlaySystemSound(mBeep); // Dispose of the sound AudioServicesDisposeSystemSoundID(mBeep);
Pingback: Snippet: Playing a System Sound | iOS Developer Zone