1
NSURL *urlString = [NSURL URLWithString:urlAddress];

//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:urlString];

//Load the request in the UIWebView.
[self.webview loadRequest:requestObj];

我有上面的代码。出于某种原因,诸如“ http://linkedin.com/view?id=3 ”之类的 url,例如,带有问号的 url 没有在 webview 中正确加载。我应该怎么办?

4

1 回答 1

0

Try this

 NSURL *url = [NSURL URLWithString: @"http://your_url.com"];
    NSString *body = [NSString stringWithFormat: @"arg1=%@&arg2=%@", @"val1",@"val2"];
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url];
    [request setHTTPMethod: @"POST"];
    [request setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];
    [webView loadRequest: request];
于 2013-07-25T02:14:31.123 回答