System Sound Services


System Sound Services provides a C interface for playing short sounds and for invoking vibration on iOS devices that support vibration.

You can use System Sound Services to play short (30 seconds or shorter) sounds. The interface does not provide level, positioning, looping, or timing control, and does not support simultaneous playback: You can play only one sound at a time. You can use System Sound Services to provide audible alerts. On some iOS devices, alerts can include vibration.


Creating and Disposing of System Sound Objects

Playing Sounds

Adding and Removing System Sound Callbacks

func AudioServicesRemoveSystemSoundCompletion(SystemSoundID)

Unregisters any completion callback functions that were registered for a specified system sound.


typealias AudioServicesSystemSoundCompletionProc

Invoked when a system sound finishes playing.

Data Types

typealias AudioServicesPropertyID

The data type for a system sound property identifier.

typealias SystemSoundID

A system sound object, identified with a sound file you want to play.


Alert Sound Identifiers

Identifiers for alert sounds and alternatives to sounds, for use with the AudioServicesPlayAlertSound(_:) function.

System Sound Services Property Identifiers

Property identifiers used when playing alerts with System Sound Services.

Result Codes

This table lists the result codes defined for System Sound Services.

var kAudioServicesBadPropertySizeError: OSStatus

The size of the property data was not correct.

var kAudioServicesBadSpecifierSizeError: OSStatus

The size of the specifier data was not correct.