NSData to NSString

10 Sep 2012

Please use:

NSString *dataStr = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];

DO NOT use:

[NSString stringWithUTF8String:[data bytes]]

It returns incorrect result. I still don't know why. I'll figure it out later.

Give it a kudos