iOS11以后怎么打开蓝牙

作者: _兜兜转转_ | 来源:发表于2018-05-17 16:18 被阅读223次

打开app设置界面

NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
            [[UIApplication sharedApplication]openURL:url];

在iOS11之前使用prefs:root=Bluetooth,打开其他的直接Bluetooth换成其他的关键字。
在iOS11之后换成了@"App-Prefs:root=General&path=Bluetooth",关键代码如下:
在iOS11中只能跳转设置界面,跳转蓝牙界面暂时做不到。

if (OS_Version<= 10) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Bluetooth"]];

        }else {//prefs:root=Bluetooth
            NSURL*  url = [NSURL URLWithString: @"App-Prefs:root=General&path=Bluetooth"];
            [[UIApplication sharedApplication] openURL:url];
        }

相关文章

网友评论

  • biubiu你妹啊:确定这个能过审核?App-Prefs:root被打回来了
    _兜兜转转_:@新_1740 我们没有啊,难道是运气!
    新_1740:你这个最后是怎么操作的啊?我们也是因为蓝牙这个私有api被拒了
    _兜兜转转_:@5eb78c79a62b 这个暂时还没上。只是能打开

本文标题:iOS11以后怎么打开蓝牙

本文链接:https://www.haomeiwen.com/subject/soobdftx.html