Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding an XCode breakpoint for logging NSData returned for NSRequest

I found breakpoint to be very convenient for getting rid of all NSLog statements trough all my code. This time I am looking for a way to print the html response coming from an NSRequest in a breakpoint.

Assuming returnData is the variable returned from my NSRequest, I have tried to add a breakpoint with a debugger command like this:

po (@"%@", returnData)

but it's giving me the whole HEX response

I then tried with this

po ([[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding])

but I am getting an error: use of undeclared identifier 'NSUTF8StringEncoding'

like image 246
Leonardo Avatar asked May 29 '13 09:05

Leonardo


1 Answers

NSUTF8StringEncoding is an NSUInteger, in NSString.h you can see the value is 4, so you could do this

po [[NSString alloc] initWithData:returnData encoding:4]
like image 158
Marcel Avatar answered Oct 29 '22 18:10

Marcel