WKWebView layout problem when tap in a form input

I have a simple ViewController with a WKWebView, the page renders ok and there is no problem at first.

This is the code:

Code Block import UIKitimport WebKitclass SignIWkWebViewViewController: UIViewController {    var wkWebView: WKWebView!   override func loadView() {     let webConfiguration = WKWebViewConfiguration()     wkWebView = WKWebView(frame: .zero, configuration: webConfiguration)     view = wkWebView   }    override func viewDidLoad() {     super.viewDidLoad()     startLoad()   }      // Receive Transfer Details and Results with a Delegate   private lazy var session: URLSession = {     let configuration = URLSessionConfiguration.default     configuration.waitsForConnectivity = true     return URLSession(configuration: configuration, delegate: self, delegateQueue: nil)   }()      var receivedData: Data?      private func startLoad(){     print("\(type(of: self)) \(#function)")          guard let url = URL(string:"https://itunesconnect.apple.com/login"else { fatalError("Can not get url") }          receivedData = Data()     let task = session.dataTask(with: url)     task.resume()   }      private func handleClientError(_ error: Error){     print("Error: \(error)")   }}   extension SignIWkWebViewViewController : URLSessionDataDelegate{ func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) {    print("\(type(of: self)) \(#function)")     guard let response = response as? HTTPURLResponse,       (200...299).contains(response.statusCode),       let mimeType = response.mimeType,       mimeType == "text/html" else {       completionHandler(.cancel)       return     }     completionHandler(.allow)   }   func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {     print("\(type(of: self)) \(#function)")     self.receivedData?.append(data)   }   func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {      print("\(type(of: self)) \(#function)")     DispatchQueue.main.async {       //self.loadButton.isEnabled = true       if let error = error {         self.handleClientError(error)       } else if let receivedData = self.receivedData,         let string = String(data: receivedData, encoding: .utf8) {         self.wkWebView.loadHTMLString(string, baseURL: task.currentRequest?.url)       }     }   }}

The issue start when I tap in the form field in the web page.

I set a breakpoint for UIViewAlertForUnsatisfiableConstraints

expr -l objc++ -O -- [[UIWindow keyWindow] autolayoutTrace]

And I got this error:

UIWindow:0x7f9ed2d05d40
|  UITransitionView:0x7f9ed2c110f0
|  |  UIDropShadowView:0x7f9ed2e071c0
|  |  |  WKWebView:0x7f9ed3027e00'iTunes Connect'
|  |  |  |  WKScrollView:0x7f9ed3827800
|  |  |  |  |  WKContentView:0x7f9ed382f800
|  |  |  |  |  |  UIView:0x7f9ed2c0a240
|  |  |  |  |  |  |  UIView:0x7f9ed2c067a0
|  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed2d13760
|  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed501d6c0
|  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed500cfd0
|  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed50063c0
|  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed501d830
|  |  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed2c18210
|  |  |  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed2c107a0
|  |  |  |  |  |  |  |  |  |  |  |  |  |  WKChildScrollView:0x7f9ed3081200
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed2c14a30
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed2c19810
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed2c10910
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed2c17dc0
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed2c19560
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  
UIScrollViewScrollIndicator:0x7f9ed500f3f0
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  UIView:0x7f9ed500f590
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  UIScrollViewScrollIndicator:0x7f9ed5019150
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  UIView:0x7f9ed50177d0
|  |  |  |  |  |  |  |  |  |  |  |  WKCompositingView:0x7f9ed2c0fd20
|  |  |  |  |  |  
UILayerHostView:0x7f9ed2d09100
|  |  |  |  |  UIView:0x7f9ed5007fd0
|  |  |  |  |  |  UITextSelectionView:0x7f9ed501bbd0
|  |  |  |  |  |  UIHighlightView:0x7f9ed2e0b7f0
|  |  |  |  |  
UIScrollViewScrollIndicator:0x7f9ed2e0ad40
|  |  |  |  |  |  UIView:0x7f9ed2e0b680
|  |  |  |  |  _UIScrollViewScrollIndicator:0x7f9ed2e0bb30
|  |  |  |  |  |  UIView:0x7f9ed2e0bcd0

Legend:
  • - is laid out with auto layout
+ - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
• - layout engine host

What is wrong in the code?
WKWebView layout problem when tap in a form input
 
 
Q