[英]How to modify NSURLRequest http method in iOS11?
我在iOS 11的WKWebView
加載NSMutableURLRequest
並出現白屏。 一旦我將NSMutableURLRequest
更改為NSURLRequest
,並避免出現這種白屏的情況,但是我想添加http方法。 誰能幫我這個?
@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];
}
在NSURLRequest中(不可更改),您可以在url本身中包含該方法。
method="get|post"
但是我不明白那白屏怎么回事:S
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.