I am loading NSMutableURLRequest
in WKWebView
on iOS 11 and getting a white screen. Once I change NSMutableURLRequest
to NSURLRequest
, and avoid this white screen view case But I want to add http method. Can anyone help me with this?
I already add this in info.plist.
@property(strong,nonatomic) WKWebView *webView;
if (@available(iOS 11.0, *)) {
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
} else {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:180];
[request setHTTPMethod:@"POST"];
[self.webView loadRequest:request];
}
In a NSURLRequest (not mutable) you can include the method in the url itself.
method="get|post"
But I don't understand what's going on with that white screen :S
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.