iOS 16.4 で Safari Web インスペクタが有効にならなくなっていたので調べてみたところ、WebView の inspectable を有効にする必要があるとのこと。
- iOS 16.4 webview can not debug in safari web inspector | Apple Developer Forums
- Enabling the Inspection of Web Content in Apps | WebKit
Swift
let webConfiguration = WKWebViewConfiguration()
let webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.isInspectable = true
Objective-C
WKWebViewConfiguration *webConfiguration = [WKWebViewConfiguration new];
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:webConfiguration];
webView.inspectable = YES;