diff --git a/ylgamehall/Source/Bridge/Handlers/RemoteAudioHandler.swift b/ylgamehall/Source/Bridge/Handlers/RemoteAudioHandler.swift index ff35b3f..3432ba8 100644 --- a/ylgamehall/Source/Bridge/Handlers/RemoteAudioHandler.swift +++ b/ylgamehall/Source/Bridge/Handlers/RemoteAudioHandler.swift @@ -338,13 +338,25 @@ public enum RemoteAudioHandler { @MainActor private static func showMicrophonePermissionAlert(on hostVC: UIViewController?) { - // 对齐 daoqi NewRootVC.m:316 文案("{gamehallname}需要访问您的麦克风...") + // 用户已拒绝麦克风权限时调用。iOS 不允许再次主动弹系统权限对话框 + // (requestRecordPermission 在 .denied 状态下不再弹窗、直接返回 false), + // 唯一恢复路径是用户手动去「设置 → app → 麦克风」开启。 + // + // 文案保留 daoqi NewRootVC.m:316 的引导语;按钮提供「去授权」直接跳 + // app 设置页(比 daoqi 仅"确定"更易用),「取消」关闭 Alert。 let alert = UIAlertController( title: nil, message: "需要访问您的麦克风,请启用麦克风-设置/隐私/麦克风!", preferredStyle: .alert ) - alert.addAction(UIAlertAction(title: "确定", style: .default)) + alert.addAction(UIAlertAction(title: "取消", style: .cancel)) + alert.addAction(UIAlertAction(title: "去授权", style: .default) { _ in + // 跳转到本 app 在「设置」中的页面。用户在此页打开麦克风开关后回到 + // app,状态自动变为 .authorized,下次 prepareaudio 走正常分支。 + if let url = URL(string: UIApplication.openSettingsURLString) { + UIApplication.shared.open(url) + } + }) hostVC?.present(alert, animated: true) } }