As answer to your question in comments:
OS_dispatch_data
is dispatch_data_t
which has toll-free bridging with NSData on iOS 7 and Mavericks. You can simply cast it to NSData *
.
So, in your case you can write:
NSData *dataCast = self.message.data;
NSString *dataString = [[NSString alloc] initWithData:dataCast encoding:NSUTF8StringEncoding];
And now you get the correct string!
In my case it appeared, when AFNetworking
cast internal NSMutableData
to NSData
.
And this simple cast helps me.
UPD: As @Daij-Djan mentioned: If it's not works - try to check your text encoding.
For example if you're yousing NSURLSessionTask
:
NSURLSessionTask *task; // Your NSURLSessionTask
NSString *encoding = [[task response] textEncodingName];
In your case (NSUTF8StringEncoding
) it should be "utf-8".