在iOS7 +上以编程方式打开蓝牙的任何方法 [英] Any way to turn on bluetooth programmatically on iOS7+

查看:60
本文介绍了在iOS7 +上以编程方式打开蓝牙的任何方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说iOS7在CBCentralManager中引入了此功能,但找不到方法.有可能吗还有另外一种使用GKPeerPickerController的widthout方法吗?

I hear that iOS7 introduced this functionality with CBCentralManager but can't find how. Is possible? There is another way widthout use GKPeerPickerController?

推荐答案

否,如果用户关闭了蓝牙,则您只能显示警报或消息,要求他们将其打开.

No, if the user has turned off Bluetooth all you can do is display an alert or message asking them to turn it on.

- (void)centralManagerDidUpdateState:(CBCentralManager *)central {

    if (central.state == CBCentralManagerStatePoweredOff) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Error" message: @"Please turn on Bluetooth in Settings" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
       [alert show]; 
    }
 }

这篇关于在iOS7 +上以编程方式打开蓝牙的任何方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆