سؤال

 NSMutableData *body = [NSMutableData data];

[body appendData:[self addFormData:@"username" withString:@"tom"]];

 NSLog(@"-----the body is %@----", body);

But the NSLog shows <0d345621 67543687 d123ab023 ........etc>

I thought it should shows "username"="tom" all those hex stuffs i mean no one will able to understand it.

هل كانت مفيدة؟

المحلول

Convert to a string for use/display, example:

NSString *str = [[NSString alloc] initWithData NSUTF8StringEncoding];
NSLog(@"str: %@", str);

Do consider the encoding that is correct for this data--if it is a character string at all.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top