I use a
AVPlayer to play audio in my iOS app (because the audio files I play are not local), and when the track is finished, I will hide the InfoCenter controls, but I get this error:
AVAudioSession.mm:1079: - [AVAudioSession setActive:withOptions:error:]: Deactivating an audio session running I / O. All I / O should be stopped or stopped before disabling the audio session.
However, I pause my
This is my code:
player.pause () player.replaceCurrentItem (with: null) MPNowPlayingInfoCenter.default (). NowPlayingInfo = null try? audioSession.setActive (false, alternatives: .notifyOthersOnDeactivation)
Due to this error, the native controls remain visible but no longer work.