When a WebView is inspectable
- Since iOS 16.4, a
WKWebVieworJSContextis only inspectable when the app setsisInspectabletotrue. Before iOS 16.4, WebViews of development builds were inspectable automatically. - The app must be a development build, installed from Xcode or with a development profile. Apps from the App Store and TestFlight cannot be inspected.
- The app has to run in the foreground while you debug; background apps do not answer.
Inspectable WebViews appear in the sidebar under your app’s name with the badge WebView, on an iPhone or iPad as well as in the iOS Simulator.
Swift
let webView = WKWebView(frame: .zero, configuration: configuration)
#if DEBUG
if #available(iOS 16.4, *) {
webView.isInspectable = true
}
#endifLimiting it to DEBUG keeps release builds closed. The same property exists on JSContext for JavaScriptCore contexts:
let context = JSContext()!
if #available(iOS 16.4, *) {
context.isInspectable = true
}Objective-C
if (@available(iOS 16.4, *)) {
webView.inspectable = YES;
}Capacitor
Capacitor controls this with webContentsDebuggingEnabled. Development builds are usually inspectable by default; set it explicitly if your WebView does not appear:
// capacitor.config.ts
const config: CapacitorConfig = {
ios: { webContentsDebuggingEnabled: true },
};Run npx cap sync ios afterwards and build the app from Xcode again.
Cordova
Recent versions of cordova-ios read the InspectableWebview preference from config.xml:
<preference name="InspectableWebview" value="true" />React Native WebView
react-native-webview exposes the switch as a property:
<WebView source={{ uri: 'https://example.com' }} webviewDebuggingEnabled={__DEV__} />Android
The Android counterpart is WebView.setWebContentsDebuggingEnabled(true), see the Android guide.
Still missing?
The iPhone & iPad guide lists what to check when a device shows no inspectable pages, and tapscope doctor reports the state of every device.