When I've discovered the services of a CBPeripheral, I call discoverCharacteristics once with all the characteristics that I'm looking for;
for (CBService *service in peripheral.services)
{
DDLogInfo(@"Kicking discovery of characteristics for servive %@", service);
[peripheral discoverCharacteristics:@[[CBUUID UUIDWithString:CHARACTERISTIC_A],
[CBUUID UUIDWithString:CHARACTERISTIC_B],
[CBUUID UUIDWithString:CHARACTERISTIC_C],
[CBUUID UUIDWithString:CHARACTERISTIC_D]]
forService:service];
}
Then, in the didDiscoverCharacteristicsForService:error:, I loop through the discovered results and store references to the characteristics that I'll need later on, and that's that.
for (CBCharacteristic *characteristic in service.characteristics)
{
if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:CHARACTERISTIC_A]])
self.currentCharacteristicA = characteristic;
else if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:CHARACTERISTIC_B]])
self.currentCharacteristicB = characteristic;
else if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:CHARACTERISTIC_C]])
self.currentCharacteristicC = characteristic;
else if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:CHARACTERISTIC_D]])
self.currentCharacteristicD = characteristic;
}
And, obviously, cleanup the self.currentCharacteristic* nicely when disconnected.