Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Revisions

2 of 2
added 94 characters in body; edited tags

Can't set httpBody on WKWebView POST request in iOS11.3

following code

var webView: WKWebView!
override func loadView() {
 super.loadView()
 self.webView = WKWebView(frame: .zero)
 view = webView
}
override func viewDidLoad() {
 super.viewDidLoad()
 
 var request = URLRequest(url: URL(string: "https://hosts")!)
 request.httpMethod = "POST"
 let bodyData = "data1=postData"
 request.httpBody = bodyData.data(using: .utf8)!
 self.webView.load(request)
}

I was able to get the POST parameter on Web site loaded on iOS 11.2, but could not get it on iOS 11.3

Why did not get it on iOS 11.3? Was the specification changed?

I want anyone to tell me the workaround. Please give me the answer.

default

AltStyle によって変換されたページ (->オリジナル) /