iOS开发之WebView怎么加载post请求并且传参数
答案:1 悬赏:0 手机版
解决时间 2021-11-20 09:55
- 提问者网友:蓝莓格格巫
- 2021-11-19 16:35
iOS开发之WebView怎么加载post请求并且传参数
最佳答案
- 五星知识达人网友:行雁书
- 2021-11-19 16:56
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];
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];
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯