private func openBluetoothSettings() { let bluetoothURL = URL(string: "App-Prefs:Bluetooth")! let settingsURL = URL(string: UIApplication.openSettingsURLString)! if UIApplication.shared.canOpenURL(bluetoothURL) { // 尝试打开蓝牙设置 UIApplication.shared.open(bluetoothURL, options: [:]) { success in if !success { // 如果蓝牙页面打不开,回退到应用设置 UIApplication.shared.open(settingsURL, options: [:], completionHandler: nil) } } } else { // 直接打开应用设置页面 UIApplication.shared.open(settingsURL, options: [:], completionHandler: nil) } }
浙公网安备 33010602011771号