views:

1453

answers:

5

I have a button in my iPhone app that I'd like to have play the default "keyboard tap" sound when it's tapped. I've been able to play my own custom sounds easily enough, but is there any way to play a default system sound like this in my app?

+1  A: 

Nothing public. There's probably an answer if you're willing to dive into private APIs, but this is strongly discouraged (as you will likely break future compatibility, and may get rejected from the app store).

Kevin Ballard
+1  A: 

There's an example on the iPhone Dev Center web site for playing short-duration sounds (5 seconds or less), You can use that code to play any sound you want. Find a click sound doing a google search and use that. That's all you need.

http://developer.apple.com/iphone/library/codinghowtos/AudioAndVideo/index.html#PLAY_SHORT_SOUNDS_AND_ALERTS_2

AudioServicesCreateSystemSoundID (fileURL, soundID);
Jordan
But how can I play the exact keyboard tap sound? I can't seem to find that anywhere on the net, and what if Apple changes it in the future?
drewh
What could they possibly change it to that would be so different? An owl hooting?
willc2
I'm sorry, I just cracked myself up making hooting noises while fake typing. Ignore me!
willc2
+2  A: 

I found this, which sounds like what you are looking for.

Surya
+1  A: 

The click sound you want is, I believe, in the sample app called SysSound.

http://developer.apple.com/iphone/library/samplecode/SysSound/

Michael