How to modify NSURLRequest http method in iOS11?

112 Views Asked by At

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.
enter image description here

@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];
}
1

There are 1 best solutions below

0
L33MUR On

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