AppsDev AppsDev - 1 year ago 183
iOS Question

AudioServicesPlaySystemSound not playing any sound in iOS 8 device

I have

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
. 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
is called... what could I be missing?

Answer Source

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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download