My app contains a custom control that copies the behavior of a standard iOS keyboard.
I can successfully play the keypress sound of the system using this code:
UIDevice.current.playInputClick()
On iOS 9 and below, there is only one click sound, and this call is all I need. On iOS 10, there are different click sounds for regular keys, for the backspace key, and for other special keys.
What is the official way to play these extra sounds? Should I use an alternate path from the linked answer? The documentation for playInputClick() says nothing.
There is an answer that suggests reproducing new click sounds using AudioServicesPlaySystemSound . But another answer says that these identifiers may not indicate the latest system click sounds in a future version of iOS. Another problem with the workaround is that there seems to be no way to check if the user has allowed keystrokes in the system settings ( link ).
ios ios10 swift audio iphone-keypad
Sebastian kirsche
source share