Cannot get playInputClick to work

I read a lot of documents and topics on how to play the keyboard, but I cannot get it to work in my application ...

I designed a custom keyboard (as a subspecies of the UIView) that uses the UIInputViewAudioFeedback protocol and returns YES for the enableInputClicksWhenVisible method.

But when I call [[UIDevice currentDevice] playInputClick] , nothing happens (whereas I hear a click when I use standard keyboards).

In the Apple UIKit help system, she wrote that it should work "only if the input representation is itself turned on and visible." My opinion is clearly visible, and even if I changed the superclass from UIView to UIControl and set self.enabled = YES, it doesn't work either ...

I have seen many solutions such as AudioServicesPlaySystemSound(1104); , but I didn’t even try, because I don’t want to play clicks if the user turned off the keystrokes in the settings.

Why doesn't the “official” solution work? This is not like obsolescence in iOS 8 ...

thanks a lot

Thomas

+6
source share

Source: https://habr.com/ru/post/977498/


All Articles