我正在尝试在 iPhone 上使用 HTTP POST 将请求传递给 URL。HTTP 正文包含一些转义字符。
NSString *requestMessage=[NSString stringWithString:@"?username/u001password/u001description"];
NSMutableURLRequest *url=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://welcome.com"]];
[url setHTTPMethod:@"POST"];
[url setHTTPBody:[requestMessage dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:url delegate:self];
这里的转义字符是/u001
.
使用此代码我没有得到任何正确的响应。我认为问题仅在于转义字符。请给我一个解决方案,了解如何在 Cocoa 中提供这样的转义序列。提前致谢。