为nsurlconnection编码NSString setHttpPostBody

时间:2012-01-21 10:06:23

标签: objective-c ios web-services

String content =“username =”+ URLEncoder.encode(username,UTF_8_TYPE);

想在objectiveC中做类似的事情

1 个答案:

答案 0 :(得分:0)

NSString *body = [NSString stringWithFormat:@"username=%@", [username stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];