Ti Inspector allows debugging Appcelerator Titanium applications in the Chrome DevTools web interface.
Currently only the iOS target platform is supported.
You can find a more detailed post and a short demo here
##NOTE - Titanium SDK 3.5.X
Currently Ti Inspector doesn't work correctly with Ti SDK 3.5.X.
In particular, the currently known issues are:
The former is also seen in the Ti Studio debugger. Follow and watch https://jira.appcelerator.org/browse/TIMOB-18616 for additional info.
While these issues are being worked on, as a temporary solution, Ti Inspector can be used by building the app with Ti SDK 3.4.1.GA during debugging
For running Ti Inspector a working node.js setup is required.
The Ti Inspector module can be installed through npm with
$ [sudo] npm install -g ti-inspector
In alternative, if you like to stay on the edge, you can pull the code from github and use
$ git clone email@example.com:omorandi/TiInspector.git $ cd TiInspector $ npm install $ [sudo] npm link
##Using Ti Inspector
ti-inspector script can be invoked from the command line with the following arguments:
ti-inspector [Options] [TiProjectDir] options: --web-host=[host] host for the inspector server (default localhost) --web-port=[port] port for the inspector server (default 8080) --debugger-port=[port] port for the Titanium debug server (default 8999) TiProjectDir: Directory containing a Titanium app project. If not specified, the current directory is used.
Supposing you have a terminal open on a directory containing the Titanium project you want to debug you can simply issue:
which runs the script with the default argument values, then point the browser to http://localhost:8080 where a web page for the current project is shown, telling that no active debugging session is present.
In order to start the Titanium application for debugging it, you have to use the Titanium CLI
build command, using the
--debug-host hidden option. For example:
$ titanium build -p iphone --debug-host localhost:8999
--debug-host argument represents the
host:port pair where the debug server is listening. This is normally provided by Titanium Studio when the project is started in debug mode, however in our case Ti Inspector will act as a debug server (listening by default on tcp port 8999) for the running app.
Once the app is running in the iOS Simulator, only the splash screen will be visible, while in the page previously opened in the browser will list the current debug session:
By clicking on it, the DevTools page will be open, showing the
app.js file source code.
From there on, you can debug your application by setting breakpoints, stepping through code, watching variables, or evaluating expressions in the console panel, etc.
- Breakpoints: setting/removing breakpoints, conditional breakpoints
- Call stack inspection (when execution is suspended)
- Variables and objects inspection
- Watch expressions
- Step operations (step over, step-into, step-out)
- Console logging
- Expression evaluation in the console (only when execution is suspended)
- Suspend on exceptions (disabled by default)
- Direct source editing and CMD-S for saving changes in your original JS files
- Android is not currently supported: supporting Android will mean implementing the V8 remote debugging protocol in Ti Inspector.
- On device debugging is not supported since it's treated in a special way by the CLI and Studio, though there exist some hackish ways for enabling it in a semi-manual way
- Expressions can only be evaluated when the execution is suspended
- TiAlloy (and any other, e.g. CoffeeScript) source mapping is not supported
- Multiple contexts (e.g. Ti.UI.Windows created through the
urlproperty) are not correctly handled
Themes FTW (available from V. 0.0.3) - NOTE: NOT WORKING SINCE v0.1.2
The DevTools app styling can be customized quite easily and some open source custom css are available from http://devthemez.com/themes/chrome-developer-tools.
These can also be used with Ti Inspector, which already includes some in the
Adding a custom Theme
If you don't like the already available themes, you can download one from http://devthemez.com/themes/chrome-developer-tools, then:
- locate the directory where Ti Inspector has been installed by npm, which is probably
/usr/local/lib/node_modules/ti-inspector. Let's call it
- Copy the downloaded css file to
- set the
TiInspector.preferences.devtools_themeproperty in the
- start Ti Inspector, or simply reload the inspector panel if already running, and enjoy your new theme
- Upgraded devtools to latest Blink revision
- Fixed breakpoint handling
- Fixed breakpoints handling in platform-specific files (full Ti 3.2.0 support)
- Fixed issues caused by latest versions of Jade in the inspection dashboard
- Fixed listing of platform-specific files (issue #16)
- Fixed websocket errors in latest Chrome Version 30.0.1599.66 (issue #7)
- Enabled console panel persistence across reloads (issue #3)
- Added "Debugger.pause" command handling
- Fixed dashboard app not showing debug sessions (issue #5)
- Updated devtools to stable Chrome 29.0.1547.65 and fixed Cobalt.css theme
- Automatic reload of the DevTools panel when a new debugging session is started: no need to go back and forth from the dashboard. Simply reload your app and Ti Inspector will restart
- Basic support for Chrome DevTools custom themes (chose a theme in the
public/js/preferences.jsfile and reload the web app in the browser)
See LICENSE file