I have AVFoundation
and AudioToolbox
frameworks added to my project. In the class from where I want to play a system sound, I #include <AudioToolbox/AudioToolbox.h>
and I call AudioServicesPlaySystemSound(1007);
. I'm testing in a device running iOS 8
, sounds are on and volume is high enough, but I don't hear any system sound when I run the app and AudioServicesPlaySystemSound(1007);
is called... what could I be missing?
This will play system sound.
But remember system sound will not play longer sound.
NSString *pewPewPath = [[NSBundle mainBundle] pathForResource:@"engine" ofType:@"mp3"];
NSURL *pewPewURL = [NSURL fileURLWithPath:pewPewPath];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)pewPewURL, &_engineSound);
AudioServicesPlaySystemSound(_engineSound);