iOS基础应用IT@程序员猿媛

iOS11以后怎么打开蓝牙

2018-05-17  本文已影响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];
        }
上一篇 下一篇

猜你喜欢

热点阅读