在WKWebView中使用HTTPBody内容执行POST请求是不可能的?

时间:2018-04-10 00:13:36

标签: ios swift

我无法使用post方法,这就是为什么我不加载网站

 let url = URL(string: "\(Application.PROTOCOL)\(Application.DOMAIN)/index.php?loc=aaaaa")
 let body = "key=\(Application.KEY)&token=\(Application.TOKEN)"
 var request = URLRequest(url: url!)
 print("request: \(request)")
 request.httpMethod = "POST"
 request.httpBody = body.data(using: String.Encoding.utf8, allowLossyConversion: true)
 self.webView.load(request as URLRequest)
 URLCache.shared.removeAllCachedResponses()

得到了这个:

Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service

0 个答案:

没有答案