How to play a System Sound on the iPhone/iPad?

2.2k views Asked by At

What is the code to play a (one of the) system sound(s)?

Not my own sound file, not an included (in my app) one. A system sound (like Basso, Blow, Bottle, Frog, etc - the .aiff ones).

I found their names to the Link but now I want to play them.

Code snippets like snippet-playing-a-system-sound don't work (I think), because I don't want to include the sounds in my app, since they are already on the device! I just want to use the ones available. But what is their NSURL location (if that is the way)?

Or if the way is like the vibrate "sound" (i.e. AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)) what is the argument for "them"?

(and...This Link is not very helpful). no surprises here.

1

There are 1 answers

2
abhishekkharwar On

Try this:

AudioServicesPlaySystemSound(1003);

For more audio codes have a look into this link: AudioServices