Xcode Printing NSData to NSLog

In Xcode Object-C to print out NSData to NSLog you might run into rubbish output by just outputting the NSData

NSLog(@"%@", myData);

And as output something like this:

<3c3f786d 6c207665 7273696f etc...

This is not rubbish, though it might look that way, this is correct behavior and is just in hex format.

If you know it’s readable data in your NSData you have to convert this into a string first.

NSString *strData = [[NSString alloc]initWithData:myData encoding:NSUTF8StringEncoding];
// Print out new string
NSLog(@"%@",strData);

The output have been convert to readable text.