iOS 跳转进蓝牙开关页

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}];
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容