Disclaimer:
- this previous question does not contain a valid answer.
- this other instead does contain the technique I used to convert it but does not answer the question I have.
Question:
I am reading some NSData from a BLE characteristic which corresponds to a string, however I have no idea what encoding format it uses.
This is the view from the debugger on Xcode:
How can I convert it to a string? I'd like to extract this value: "<951c7c1d e0fbdcc3 7b8b0b97 5c522036>"
I tried the following with with no meanigful conversion. However XCode seems to do the job. Why?
NSData * valueAsData = characteristic.value.mutableCopy;
NSString* newStr = [[NSString alloc] initWithData:characteristic.value encoding:NSUTF8StringEncoding];
NSString* newStr2 = [[NSString alloc] initWithData:characteristic.value encoding:NSASCIIStringEncoding];