Developer

Debugging on iOS

Use Safari Web Inspector to debug an iOS app that includes Apache Cordova and Kapsel plugins.

Prerequisites

  • Device or simulator running iOS 6 or higher.
  • Mac with Safari 6 or higher.
  • Connect the device to the Mac with a USB cable, or start the simulator.
  • Turn on Web Inspector using Start of the navigation path Settings Next navigation step Safari Next navigation step  Advanced Next navigation step  Web Inspector Next navigation step  On End of the navigation path.

Procedure

  1. On the device or simulator, open a Kapsel app or a web page in the Safari browser.
  2. In Safari on the Mac, choose Start of the navigation path Develop Next navigation step iPhone Simulator Next navigation step  index.html End of the navigation path.
  3. (Optional) To debug starting from the init method, set a breakpoint in the init method using one of the following:
    • In the console, enter:
      window.location.reload()
    • Call:
      cordova.fireDocumentEvent('deviceready');
  4. (Optional) Choose one or more breakpoints to step through. The chosen breakpoints appear in the Breakpoints panel.
  5. (Optional) From the Elements panel, choose an HTML element to view, or modify its HTML and CSS properties.
  6. (Optional) In the Console drawer, enter commands to modify the source file code.
  7. (Optional) From the Network panel, examine data URL requests and responses (values received).