I have been unable to convert CBCharacteristic's value property which is of type NSData to NSString. I tried the usual initWithData:encoding: method of NSString as given below. But it returns nil.
NSString *str = [[NSString alloc] initWithData:characteristic.value encoding:NSUTF8StringEncoding];
NSLog(@"%@", str);
I am able to see the string value on console when I do NSLog on value directly.
NSLog(@"characteristic.value: %@", characteristic.value);
Can aanybody give any idea on how to get the string value out of characteristic.value?
NSData
) have a meaning in UTF8 String. You'll probably get nil if you convert[[NSString alloc] initWithData:UIImagePNGRepresentation(someUIImage) encoding:NSUTF8StringEncoding];
. – Larme@"11122334 45566778 899aabbc cddeeff0 00"
as NSString into NSData and do aisEqual:
. – Larme