Web pages cannot be debugged in Safari development after iOS 16.4

There is WKWebView in the project, and Safari debugging cannot be used after the iPhone and simulator are upgraded to 16.4?

It was good before, why not now?

At this time, there are two options,

First, you can use low-version emulators 16.2 & 16.0, etc.

Second, set inspectable (OC), isInspectable (Swift)

----------------------

The official document  isInspectable | Apple Developer Documentation

To put it simply, in iOS 16.4 WKWebView adds a property  isInspectable  to control => whether you can use Safari to check the JS Code, HTML and other content in the web page, which needs to be set manually.

// OC
if (@available(iOS 16.4, *)) {
    webView.inspectable = true;
} else {
    // Fallback on earlier versions
}
// Swift
if #available(iOS 16.4,*) {
    webView.isInspectable = true
} else {
    Fallback on earlier versions
}

If I am not clear, you can also ask GPT,

thanks for watching,

Thank you for applying what you have learned.

Guess you like

Origin blog.csdn.net/siwen1990/article/details/130363477