更新时间:2022-06-11 00:14:47
Her derTöne的注释向您显示了新语法,但是您还需要在setCategory
之后激活音频会话:
Her der Töne's comment shows you the new syntax, but you also need to activate the audio session after setCategory
:
do {
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default)
try AVAudioSession.sharedInstance().setActive(true)
} catch {
print(error)
}