今是昨非

今是昨非

日出江花红胜火,春来江水绿如蓝

iOS 16.4 Webview cannot be debugged with Safari.

Background#

After upgrading Xcode to 14.3, the simulator is iOS 16.4. I wanted to use Safari -> Developer -> Web Inspector to debug, but found that it couldn't be accessed.

Modification#

At first, I thought it might be because the "Advanced" setting in Safari was not enabled. After checking, I found that the switch was already turned on.

After searching, I found that starting from iOS 16.4, in order to use Web Inspector for debugging, the following code needs to be set:

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

After setting it, run again and check with Safari, and you will be able to see it.

Reference#

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.