After connecting to a BLE device that advertises a specific service that interests me, to open this service, I call:
[self.peripheral discoverServices:@[[self.class serviceUUID]]];
The delegate method - (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error is called without errors, but the number of services returned for the periphery is 0, and therefore no signs were found. Does anyone know why this is happening? Thanks in advance!
Below is the full text of the delegate method.
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error { if (error) { NSLog(@"didDiscoverServices failed: %@", error); return; } NSLog(@"didDiscoverServices succeeded for peripheral: %@.", peripheral.name); NSLog(@"Number of services: %d", peripheral.services.count); for (CBService *s in peripheral.services) { NSLog (@"Discovered service UUID: %@", s.UUID); if ([s.UUID isEqual:[self.class serviceUUID]]) { NSLog(@"Discover characteristics..."); [self.peripheral discoverCharacteristics:@[[self.class controlPointCharacteristicUUID], [self.class packetCharacteristicUUID]] forService:s]; } } }
The console shows:
2014-11-27 15:54:51.933 k[197:13362] didDiscoverServices succeeded for peripheral: BootK 2014-11-27 15:54:51.934 k[197:13362] Number of services: 0
source share