I'm working on BLE, my code run perfectly on bluetooth 4.2 devices (iPhone SE, iPhone 6, iPhone 6 Plus, iPhone 7). When I switch to on Bluetooth 5.0 devices(iPhone X, iPhone 8 Plus), my code will stop at didDiscoverPeripheral function, will not get into didConnectPeripheral function.
- (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]]];
}