if let url = URL(string: UIApplication.openSettingsURLString),
UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
上面代码只能打开 App 的设置页,无法直接进入到蓝牙的开关开启页。
当 iOS控制中心的蓝牙开关关闭后(非蓝牙权限开关),可以用下面代码直接打开蓝牙开关的页面。
[[CBCentralManager alloc] initWithDelegate:self
queue:nil
options:@{CBCentralManagerOptionShowPowerAlertKey: @1}];