Skip to content

Debugging Web Views

When working with hybrid apps that combine web technologies with native Swift functionality, debugging can be challenging. Issues often occur at the boundary between web and native code. This guide provides effective debugging strategies specifically for enClose applications.

Enable Debug Mode

  • Set debugMode = true in MainViewController.swift to make web views inspectable

Configure Your Device

Not required for Simulator

  • Enable Web Inspector in Safari on your device by:
    1. Open the Settings app on your iOS device
    2. Scroll down and tap on Safari
    3. Scroll to the bottom and tap on Advanced
    4. Toggle on Web Inspector

Configure Safari on Your Mac

  1. Enable the Developer menu in Safari settings by checking Show features for web developers under the Advanced tab
  2. Once enabled, Safari Developer Tools can connect to your web views

Debugging Features

When debug mode is enabled:

  • Each native function call from enClose will be logged in the JavaScript console
  • You can use Safari's debug tools and inspectors to:
    • Monitor variables
    • Modify style sheets
    • Execute JavaScript directly in the context of your app