3.E 优化:权限被拒绝时的 Alert 增加"去授权"跳转按钮

iOS 行为约束:用户在系统权限对话框选择"拒绝"后,再次调
requestRecordPermission 不会再弹对话框、直接返回 false。唯一恢复路径
是用户手动去「设置 → app → 麦克风」开启。

原 Alert 只有"确定"按钮(对齐 daoqi),用户被拒绝后需要自己摸索路径
去设置。优化为两按钮:

- "取消":关闭 Alert
- "去授权":UIApplication.open(openSettingsURLString) 直接跳本 app
  的设置页

文案保留 daoqi NewRootVC.m:316 的引导语("需要访问您的麦克风,请启用
麦克风-设置/隐私/麦克风!")。

属于 UX 改进,对 H5 不可见,不影响契约(按钮属于 native 内部 UI,
原则 B 范畴)。
This commit is contained in:
joywayer
2026-06-24 01:58:02 +08:00
parent 530309c258
commit 6f10d231ad
@@ -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)
}
}