search

Home  >  Q&A  >  body text

ios - WKWebView怎么加载post请求并且传参数?

我用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请求。

巴扎黑巴扎黑2771 days ago664

reply all(4)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 09:17:30

    Are you sure you addSubView?

    reply
    0
  • 迷茫

    迷茫2017-04-18 09:17:30

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

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:17:30

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

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 09:17:30

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

    reply
    0
  • Cancelreply