Using system sound for a UI Alert

Does below note in https://developer.apple.com/documentation/audiotoolbox/1405202-audioservicesplayalertsound

Note

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


means that we could not use any of system sounds in iOS App?

We are able to play a system sound using AVAudioPlayer unlike above example.

it means you can't remap a system defined resource to your app, like use the phone ringing sound as a twitter alert


you can use a supplied resource by using the correct id, like


iphonedevwiki.net/index.php/AudioServices


see


developer.apple.com/documentation/audiotoolbox/system_sound_services

You can play system sounds in IOS.

Look here for detais:

h ttps://stackoverflow.com/questions/31126124/using-existing-system-sounds-in-ios-app-swift


I think the note is about alert sounds specifically.

So could we play the system sound( say dtmf-0.caf) while showing Alert in iOS App and pass through Apple review for App Store?

My belief (but I didn't try), is that you could call the system sound before calling the alert, then let the alert play its own sound. I see no reason why it would be refused.


But you would get a sequence of 2 sounds, which may not be that good.

Presently UI Alert controller is not playing sound,so only one system sound(say dtmf-0.caf) is played using AVAudioPlayer.

Though AVAudioPlayer interface to play system sound(by creating our own soundID) is public the sound file (say dtmf-0.caf or systemSoundID) is not, below threads also lead to my concern of App rejection.

/thread/https:/ <p style=https://forums.developer.apple.com/message/133125#133125

https://forums.developer.apple.com/message/60731#60731

to be in resource bundleWell, I would trust what KMT has stated.


However, I'm suprised a call like

AudioServicesPlaySystemSound(1519)

could cause App to be rejected. Or maybe because as the value 1519 is undocumented, it could disappear without notice in the future ; with the risk of no sound to play.


Otherwise, maybe you can create the sounds programmatically :


    func playMySound(direction forward: Bool) {
        var filePath: String?
            filePath = Bundle.main.path(forResource: "AlertSound", ofType: "wav")          // AlertSound
            let fileURL = URL(fileURLWithPath: filePath!)
            var soundID:SystemSoundID = 0
            AudioServicesCreateSystemSoundID(fileURL as CFURL, &soundID)
            AudioServicesPlaySystemSound(soundID)
    }
Using system sound for a UI Alert
 
 
Q