【问题标题】:ios- cbcentralManager state unknown and CoreBluetooth[WARNING] <CBConcreteCentralManager> is not powered onios- cbcentralManager 状态未知且 CoreBluetooth[WARNING] <CBConcreteCentralManager> 未通电
【发布时间】:2013-02-06 05:16:23
【问题描述】:

我正在开发 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];
}

我该如何解决?

【问题讨论】:

    标签: ios bluetooth core-bluetooth


    【解决方案1】:

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

    【讨论】:

    • 嗯,如果是温度传感器应用程序,那么蓝牙设备必须是启用了 BT 的温度传感器吧?
    • @DennisMathews:链接断开。
    猜你喜欢
    • 2016-01-12
    • 2017-09-20
    • 1970-01-01
    • 2012-11-19
    • 2016-08-17
    • 2015-07-17
    • 1970-01-01
    • 1970-01-01
    • 2020-01-31
    相关资源
    最近更新 更多