0

我有一个使用 ble 连接到设备的 iOS 应用程序。iOS 7 正在运行。升级到 iOS 8 后,CBCentralManager 没有找到任何外围设备。

    case CBCentralManagerStatePoweredOn:
    {

        NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE], CBCentralManagerScanOptionAllowDuplicatesKey, nil];
        //NSArray *services = [NSMutableArray new];
        NSArray *services = @[[CBUUID UUIDWithString:@"0000FBB0-494C-4F47-4943-544543480000"], [CBUUID UUIDWithString:@"180A"]];
        [centralManager scanForPeripheralsWithServices:services options:options];

        break;
    }
4

1 回答 1

0

尝试移动此代码:

 NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE], CBCentralManagerScanOptionAllowDuplicatesKey, nil];
    //NSArray *services = [NSMutableArray new];
    NSArray *services = @[[CBUUID UUIDWithString:@"0000FBB0-494C-4F47-4943-544543480000"], [CBUUID UUIDWithString:@"180A"]];
    [centralManager scanForPeripheralsWithServices:services options:options];

进入 Iba 操作,然后在 CBCentralManagerStatePoweredOn 上调用该操作

于 2014-09-23T01:20:51.743 回答