ios - WKWebView怎么加载post请求并且传参数?
巴扎黑
巴扎黑 2017-04-18 09:15:30
0
4
661

我用UIWebView加载出来了,但是换成WKWebView就加载失败,错误原因是post请求的参数没传过去。
UIWebView的加载代码是这样的

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];

换成WKWebView就加载不出来了,请教下各位,怎么样用WKWebView加载POST请求。

巴扎黑
巴扎黑

reply all(4)
Ty80

Are you sure you addSubView?

迷茫

According to the above code, the request should be sent normally.
Can you provide a demo of the error?

伊谢尔伦

http://www.jianshu.com/p/4038...

Peter_Zhu

My question is, blogger, have you solved this problem? If you solve it, please let me know

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template