Posts

Post not yet marked as solved
8 Replies
24k Views
Hello,I'm writing an application that uses WKWebView on iOS 11.4.We initiate the webview by loading a remote URL. Then the user navigates normally, but when we are about to load a certain url (as detected by the delegate method "func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {we must make a submit to a given url (basically we must authenticate the user with a pair of credentials he has stored in the App beforehand).we tried this var urlRequest = URLRequest(url: URL(string: "https://xxxxxx/login")!) urlRequest.httpMethod = "POST" let params = [ "username": SessionManager.shared.username!, "password": SessionManager.shared.password!, "vhost": "standard" ] let postString = self.getPostString(params: params) urlRequest.httpBody = postString.data(using: .utf8) webView.load(urlRequest) ... //helper method to build url form request func getPostString(params:[String:String]) -> String { var data = [String]() for(key, value) in params { data.append(key + "=\(value)") } return data.map { String($0) }.joined(separator: "&") }But then we check the same request in the delegate methodfunc webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { print("BODY", navigationAction.request.httpBody)and the body is null.In fact the request fails and we get an error in the WKWebView page.Is this still the bug as inhttps://forums.developer.apple.com/thread/18952or is it something I'm doing wrong?ThanksW
Posted
by zontar.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
Hello,I'm using several iPad for development and test. The last one I tried to add to my working developer profile, either from XCode or from the web site, gives me an unspecified error:Unexpected error occurredAs far as I know I resetted the iPad (iPad air 2nd gen) to factory defaults yesterday. It has iOS 11.2 and is exaclty the same as the others.Any ideas?ThanksW
Posted
by zontar.
Last updated
.