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.