Hemang Hemang - 1 month ago 6
iOS Question

How to get exact value from a CBCharacteristic?

<CBCharacteristic: 0x156d48cf0, UUID = BLevel, properties = 0x18, value = <32353732 380d0a>, notifying = YES>


I want to extract what's there in value field.

NSData *data = c.value; // c is of type CBCharacteristic


But I don't know which kind of value it is?

Answer

You can convert the NSData to an NSString using

NSString *str = [[NSString alloc] initWithData:c.value encoding:NSUTF8StringEncoding];
Comments