I want to trigger a remote control event such as UIEventSubtypeRemoteControlTogglePlayPause
programatically. The application that I have in mind is a voice remote control application (even if it already exists) which receives the command "Play" and it simply generates the event UIEventSubtypeRemoteControlTogglePlayPause
. Any app registered as the first responder for this event will get it. I.e. my app simply translates voice to remote control commands.
Ideas?
It's not possible to generate UIEvent
s programmatically.
You can do it by using private API (google synthesize UIEvent
). Some testing frameworks do that. Also, for testing, you can inject Apple's UI Automation framework into the application and use its method to generate events (mostly touch events, headers available on github).
However, synthesizing events is something you can't do in an Appstore application. If you need to do that, it's a bad design.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With