我想从蓝牙免提设备接收远程控制事件,下面提到的是我的播放和暂停事件的代码集。
MPRemoteCommandCenter.shared().nextTrackCommand.isEnabled = true
MPRemoteCommandCenter.shared().previousTrackCommand.isEnabled = true
MPRemoteCommandCenter.shared().nextTrackCommand.addTarget(self, action: #selector(playCommand))
MPRemoteCommandCenter.shared().previousTrackCommand.addTarget(self, action: #selector(previousCommand))但不会触发此类事件。任何帮助都将不胜感激。
发布于 2017-12-06 17:41:28
你需要打电话给
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];在……里面
viewWillAppear()以使您的应用程序获得所需的事件。
https://stackoverflow.com/questions/46294193
复制相似问题