При включенном звуке в моем приложении нажатие клавиши уменьшения громкости вниз до 1 1 больше не будет уменьшаться.Я нажимаю клавишу уменьшения громкости на 1. Я хочу отключить звук.
Я использовал Swift 4, iOS 11
В didFinishLaunchingWithOptions
let session: AVAudioSession = AVAudioSession.sharedInstance()
do {
if #available(iOS 10.0, *) {
try session.setCategory(AVAudioSessionCategoryPlayAndRecord, mode: AVAudioSessionModeDefault, routeSharingPolicy: .longForm, options: [.defaultToSpeaker , .allowAirPlay ,.allowBluetooth ,.allowBluetoothA2DP])
try session.overrideOutputAudioPort(AVAudioSessionPortOverride.none)
} else {
session.perform(NSSelectorFromString("setCategory:withOptions:error:"), with: AVAudioSessionCategoryPlayAndRecord, with: [AVAudioSession.CategoryOptions.allowBluetooth,AVAudioSession.CategoryOptions.allowBluetoothA2DP,AVAudioSession.CategoryOptions.allowAirPlay])
}
try session.setActive(true)
} catch {
}
let commandCenter = MPRemoteCommandCenter.shared()
commandCenter.nextTrackCommand.isEnabled = false
commandCenter.previousTrackCommand.isEnabled = false
commandCenter.skipForwardCommand.isEnabled = false
commandCenter.skipBackwardCommand.isEnabled = false
Я хочу, чтобы громкость поворотаполностью выключается, когда я нажимаю клавишу уменьшения громкости.Есть ли проблема с моей AVAudioSession?