Icono de la app WebView Inspector

WebView Inspector

Cómo inspeccionar un WKWebView desde Safari

Herramientas para desarrolladores iOS & macOS

Ahora mismo no está en el App Store

Categoría
Herramientas para desarrolladores
Funciona en
iPhone, iPad, Mac
Desarrollador
Cihat SALİK

Enable Safari Web Inspector on a WKWebView

Esta guía paso a paso está escrita solo en inglés y turco. Leerla en inglés

Set isInspectable to true on the web view, turn on Web Inspector on the device, then choose the page in the Develop menu of Safari on a Mac. Apps linked against the iOS 16.4 and macOS 13.3 SDKs or later need this even in debug builds, because a WKWebView is not inspectable by default.

  1. Set isInspectable in your app

    let webView = WKWebView(frame: .zero, configuration: WKWebViewConfiguration())
    
    #if DEBUG
    if #available(iOS 16.4, macOS 13.3, *) {
        webView.isInspectable = true
    }
    #endif

    The property belongs to WKWebView, not to WKWebViewConfiguration, and you set it on each view. You can change it at any point in the view's life. In Objective-C it is webView.inspectable = YES. Anyone who turns on Web Inspector can inspect a view with this setting, so keep the #if DEBUG unless release builds should be inspectable too.

  2. Turn on Web Inspector on the iPhone or iPad

    Open Settings, go to Apps, then Safari, then Advanced, and turn on Web Inspector. On iOS 17 and earlier the path is Settings, Safari, Advanced. Simulators always have it on, and a Mac app does not need this step.

  3. Show the Develop menu in Safari on the Mac

    Choose Safari, then Settings, open the Advanced pane and check Show features for web developers.

  4. Open the inspector

    Connect the device with a cable and trust the Mac if the device asks. Run your app, open the Develop menu, choose the device, simulator or your Mac, then choose the page under your app's name.

If the web view is not in the Develop menu

Check that this exact view has isInspectable set, since the setting does not carry over to other views. Then check the Web Inspector switch on the device and the trust prompt. A JSContext has the same isInspectable property, and giving it a name makes it easy to find in the menu.

Apple documentation: Enabling inspecting content in your apps · Inspecting iOS and iPadOS

Looking for the app that took over this App Store listing? See Paidly: Invoice Maker

Descripción

WebView Inspector era una herramienta pequeña para cargar una URL en un WKWebView e inspeccionarla desde Safari. La ha sustituido Paidly, una app distinta para facturas y presupuestos, y su navegador integrado ya no existe.

El mismo trabajo se puede hacer sin una app aparte. Cualquier WKWebView de tu propio proyecto se puede inspeccionar con una línea de código y Safari en un Mac, siguiendo los pasos de esta página.

Preguntas sobre WebView Inspector

¿En qué dispositivos funciona WebView Inspector?
WebView Inspector funciona en iPhone, iPad, Mac. Está hecha en SwiftUI para las plataformas de Apple, así que respeta la apariencia del sistema, el Texto Dinámico y VoiceOver.
¿Cuánto cuesta WebView Inspector?
WebView Inspector ahora mismo no está en el App Store. Esta página sigue publicada por su política de privacidad, sus condiciones y su soporte, y para quien todavía tenga la app instalada.
¿Quién hace WebView Inspector?
Cihat SALİK, desarrollador independiente en Estambul, programa y publica WebView Inspector y todas las demás apps de aquí. El soporte lo responde la misma persona que escribió el código.
¿Cómo consigo ayuda con WebView Inspector?
La página de soporte de WebView Inspector responde a las preguntas más habituales, y un correo a [email protected] llega directamente al desarrollador.

Del mismo rincón de la caja

Si WebView Inspector es lo tuyo, estas viven en el mismo barrio — todas salidas de las mismas manos.