I have developed a Bluetooth Low Energy peripheral app that successfully connects with a second BLE central app. However, I am unable to get the central app to subscribe to notifications for one of the characteristics of the service offered by the peripheral. In the central app, I have the following:
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
{
if ([service.UUID isEqual:[CBUUID UUIDWithString:IMMEDIATE_ALERT_SERVICE_UUID]]) {
for (CBCharacteristic *aChar in service.characteristics) {
if ([aChar.UUID isEqual:[CBUUID UUIDWithString:ALERT_LEVEL_CHARACTERISTIC_UUID]]) {
[peripheral setNotifyValue:YES forCharacteristic:aChar];
Unfortunately, this fails and an error is received at the delegate method peripheral:didUpdateNotificationStateForCharacteristic (error type is "unknown"). If I print the characteristic object in the above code (aChar), I get the following:
<CBCharacteristic: 0x1464f560, UUID = 2A06, properties = 0x2, value = (null), notifying = NO>
Notice that notifying = NO. How do I set up the peripheral to enable the characteristic to notify?