ios- cbcentralManager状态未知且CoreBluetooth [警告] <cbconcretecentralmanager>未启动</cbconcretecentralmanager>

时间:2013-02-06 05:16:23

标签: ios bluetooth core-bluetooth

我正在研究CoreBluetooth框架。我运行着名的temperatureSensor应用程序但是当我在模拟器上运行时,我收到以下警告:

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

我检查了CBCentralManager的状态Unknown。以下是代码:

(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];
}

我该如何解决?

1 个答案:

答案 0 :(得分:0)

似乎蓝牙设备未连接或未检测到。 您需要连接外部USB BLE加密狗才能将其与模拟器一起使用,即使您的机器可能具有BTLE功能。 来自Apple的这个application note可能很有帮助