如何MPRemoteCommandCenter.shared()
从通知中心删除。我尝试了这段代码,但只有命令和操作被禁用。我需要从通知中心删除完整通知。当我们杀死应用程序时,它不会出现在通知栏中,当我移动到其他屏幕时,我希望做同样的事情。
func removeCommanCenter() {
let commadCenter = MPRemoteCommandCenter.shared()
commandCenter.previousTrackCommand.isEnabled = false
commandCenter.nextTrackCommand.isEnabled = false
commandCenter.playCommand.isEnabled = false
commandCenter.pauseCommand.isEnabled = false
commandCenter.changePlaybackPositionCommand.isEnabled = false
commandCenter.nextTrackCommand.removeTarget(self, action: #selector(self.loadNextVideos))
commandCenter.previousTrackCommand.removeTarget(self, action: #selector(self.loadPrevoiusVideos))
commandCenter.playCommand.removeTarget(self, action: #selector(self.audioPlayerView.customPlayer?.togglePlay(_:)))
commandCenter.pauseCommand.removeTarget(self, action: #selector(self.audioPlayerView.customPlayer?.togglePlay(_:)))
commandCenter.changePlaybackPositionCommand.removeTarget(self, action: #selector(self.audioPlayerView.customPlayer?.handleChangePlaybackPositionCommandEvent(event:)))
}