Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to use Apple system sounds in my iOS app?

Can you use the system sounds in your iOS app? I'm looking to have the same list that is used in the default timer app (Marimba, Alarm, Doorbell etc).

Reason i'm asking is that in Apple's own Multimedia docs it says:

Note: System-supplied alert sounds and system-supplied user-interface sound effects are not available to your application. For example, using the kSystemSoundID_UserPreferredAlert constant as a parameter to the AudioServicesPlayAlertSound function will not play anything.

Then i've come across this list of system sound ID's.

So can you use access and use these sounds in your own apps which will pass Apple's review process? If not are similar sounds available open source?

like image 999
JMWhittaker Avatar asked Nov 12 '22 05:11

JMWhittaker


1 Answers

Actually if you use AudioToolbox/AudioToolbox.h framework and import it in your header file for the view controller, you can play Apple system sounds without jailbreaking. For example, putting

AudioServicesPlaySystemSound(0x450);

under an IBAction will play the Apple 'click' sound on the execution of the action.

Also, to hear the system sounds referenced earlier, there is a great app available on github that works on your iPhone (not the iOS simulator) that has the sounds for you to click and hear, as the documentation references them, but you cannot hear them. The app is nice to listen to and then find the corresponding reference number.

like image 157
Clayton C. Avatar answered Nov 15 '22 06:11

Clayton C.