iOS Core Bluetooth не работает на устройствах Bluetooth 5.0 (iPhone X, iPhone 8, iPhone 8 Plus)

Я работаю над BLE, мой код отлично работает на устройствах Bluetooth 4.2 (iPhone SE, iPhone 6, iPhone 6 Plus, iPhone 7). Когда я переключаюсь на устройства Bluetooth 5.0 (iPhone X, iPhone 8 Plus), мой код останавливается на функции didDiscoverPeripheral, не попадает в функцию didConnectPeripheral.

- (void) centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {

    if ([peripheral.name isEqualToString:bleDic[@"name"]]) {

        self.connectedPeripheral = peripheral;
        self.connectedPeripheral.delegate = self;                           
        [self.cm connectPeripheral:self.connectedPeripheral options:nil];
    }
}

- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral {

   [self.connectedPeripheral discoverServices:@[[CBUUID UUIDWithString:ServiceUUID]]];
}

0 ответов

Другие вопросы по тегам