ios- cbcentralManager状态未知CoreBluetooth【警告】< CBConcreteCentralManager>未开启 [英] ios- cbcentralManager state unknown and CoreBluetooth[WARNING] <CBConcreteCentralManager> is not powered on

查看:410
本文介绍了ios- cbcentralManager状态未知CoreBluetooth【警告】< CBConcreteCentralManager>未开启的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作CoreBluetooth框架。我跑了著名的温度传感器节应用程序,但是当我在模拟器上运行它,我得到以下警告:

I am working on CoreBluetooth framework. I ran the famous temperatureSensor application but when i run it on simulator I get the following warning:

 CoreBluetooth[WARNING] <CBConcreteCentralManager: 0x713b550> is not powered on

和我检查 CBCentralManager 未知的状态。以下是code:

and I checked the state of CBCentralManager it is Unknown. Following is the code:

(void) startScanningForUUIDString:(NSString *)uuidString {
    centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];

    if ([centralManager state] == CBCentralManagerStatePoweredOff) NSLog(@"CBCentralManagerStatePoweredOff");
    if ([centralManager state] == CBCentralManagerStatePoweredOn) NSLog(@"CBCentralManagerStatePoweredOn");
    if ([centralManager state] == CBCentralManagerStateResetting) NSLog(@"CBCentralManagerStateResetting");
    if ([centralManager state] == CBCentralManagerStateUnauthorized) NSLog(@"CBCentralManagerStateUnauthorized");
    if ([centralManager state] == CBCentralManagerStateUnknown) NSLog(@"CBCentralManagerStateUnknown");
    if ([centralManager state] == CBCentralManagerStateUnsupported) NSLog(@"CBCentralManagerStateUnsupported");
    NSArray *uuidArray = [NSArray arrayWithObjects:[CBUUID UUIDWithString:uuidString], nil];

    NSLog(@"%@", uuidArray);
    NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:CBCentralManagerScanOptionAllowDuplicatesKey];
    [centralManager scanForPeripheralsWithServices:uuidArray options:options];
}

我该如何解决呢?

How do I solve it?

推荐答案

好像蓝牙设备没有连接或没有检测到。
您需要连接外部USB加密狗BLE要能够与模拟器使用它,即使你的机器可能是BTLE能力。
从苹果这应用笔记可能helful

Seems like the bluetooth device is not connected or not detected. You will need to connect an external USB BLE dongle to be able to use it with the simulator even though your machine might be BTLE capable. This application note from Apple might be helful

这篇关于ios- cbcentralManager状态未知CoreBluetooth【警告】&LT; CBConcreteCentralManager&GT;未开启的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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