iOS - UIEventTypeRemoteControl events not received

≡放荡痞女 提交于 2019-11-29 07:46:20
soleil

ok, a few more hours of my life into black hole of Apple. Turns out that you can only capture remote control events after you have played audio of some kind using the AVAudioPlayer, or if you play a video file that has audio. This is not documented anywhere here.

So in my case I have to play a dummy silent audio file first before I try to capture remote control events. Hope this helps someone down the line.

(Update) Please note that the updated documentation now states the following:

To receive remote control events, your app must do three things:

  • Be the first responder. The view or view controller that presents the multimedia content must be the first responder.
  • Turn on the delivery of remote control events. Your app must explicitly request to begin receiving remote control events.
  • Begin playing audio. Your app must be the “Now Playing” app. Restated, even if your app is the first responder and you have turned on event delivery, your app does not receive remote control events until it begins playing audio.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!