Reputation: 9857
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'
Upvotes: 8
Views: 1532
Reputation: 6579
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]
Upvotes: 16
Reputation: 321
NSUTF8StringEncoding is enum declared in NSString.h which is declared in foundation framework. did you double check that foundation framework is imported in project ? if yes, then try to import NSString.h and recompile.
On the other hand I print nsdata like this
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"Response:%@",responseString);
Upvotes: -1