When an input in WKWebView
gets focused a constraints error pops up.
Code:
class ViewController: UIViewController {
My assumption is this a bug in ios 11. The complaints are about the components in the button bar for the keyboard which are all using default values set by the os. I have run the same code on both ios 9 and ios 10 and get no error messages.
Having the same issue. I'm running a clean project, vanilla setup and this issue comes up as soon as the webview keyboard gets focus. It seems to be a common issue, might just be a bug in iOS 11.
Also see:
WKWebView LayoutConstraints issue
One or more constraints are not compatible at the same time when keyboard is open.
Instead of doing frame by hand, try setting constraints to ur WKWebView.
private func addWKWebView(){
let wv = WKWebView()
view.addSubview(wv);
wv.translatesAutoresizingMaskIntoConstraints = false
wv.widthAnchor.constraint(equalTo: view.widthAnchor ).isActive = true
wv.heightAnchor.constraint(equalTo: view.heightAnchor ).isActive = true
wv.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
wv.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
}
or Something like this:
private func addWKWebView(){
let wv = WKWebView()
view.addSubview(wv);
wv.translatesAutoresizingMaskIntoConstraints = false
wv.widthAnchor.constraint(equalToConstant: 100).isActive = true
wv.heightAnchor.constraint(equalToConstant: 100).isActive = true
wv.widthAnchor.constraint(equalToConstant: 100).isActive = true
wv.heightAnchor.constraint(equalToConstant: 100).isActive = true
}
U need to play around with your constraints to set the WkWebView where u want.