iOS开发之WebView怎么加载post请求并且传参数

如题所述

UIWebView *webView = [[UIWebView alloc] init];
NSString *bodyShare = [NSString stringWithFormat: @"hID=%@", userID];
NSMutableURLRequest * requestShare = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:self.urlStr]];
[requestShare setHTTPMethod: @"POST"];
[requestShare setHTTPBody: [bodyShare dataUsingEncoding: NSUTF8StringEncoding]];
[webView loadRequest:requestShare];
温馨提示:答案为网友推荐,仅供参考
相似回答