7

hi i need to use beep on iphone, but the only thing i have found is this

NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"alert" ofType:@"wav"];

    SystemSoundID soundID;

    AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath: soundPath], &soundID);

    AudioServicesPlaySystemSound (soundID);

    [soundPath release]; 

it is working and good code but i need to import the alert.wav file.But i rather do this with native (built in) sounds if there exist.

thanks for all the answers cs.

Csabi
  • 3,097
  • 17
  • 59
  • 107
  • possible duplicate of [Play alert sound (same as default message ringtone)](http://stackoverflow.com/questions/5250200/play-alert-sound-same-as-default-message-ringtone) – Joachim Sauer May 04 '11 at 12:44

1 Answers1

19

Reading the documentation of Apple and this, I'm almost certain that you can play that wanted sound without carrying it.

You can do this:

AudioServicesPlaySystemSound(1005);

that should do.

Reference: here

Community
  • 1
  • 1
Diego Torres
  • 5,308
  • 5
  • 25
  • 29
  • 4
    Reading the documentation on that function, it seems that using such pre-defined IDs no longer works on new OS versions and, if it does, that doing so is a violation of App Store guidelines and might get one's app rejected. – AndrewS Nov 01 '11 at 16:46
  • 1
    Does anybody have info on whether using 'AudioServicesPlaySystemSound(1005);` will get the app rejected for sure? because I google'd it and everybody says "might/may get rejected". I am in the same situation as above. Any help would be appreciated. Thanks. – iphondroid Mar 31 '14 at 07:36