TiShadow – and native modules

If you develop mobile applications using Appcelerator Titanium then you really should use TiShadow. Instead of waiting perhaps a minute for your project to build and show on the simulator/emulator then you can use the TiShadow server on your computer and the TiShadow app on the device/simulator/emulator to “connect” Studio with the TiShadow app – and get updates everytime you save within 1-2 seconds. Smashing!!

I will not go into details on how to install and set up TiShadow – just follow the link above and you should be fine.

However, there is one thing that may “trick” you if you do not remember all that you have read in the readme file. If you use a native module in your app then it may throw an error at you like:

App error

If you check the TiShadow server console you could find something like:

[DEBUG] [iphone, 7.1, 192.168.42.38] Native module:ti.map
[ERROR] [iphone, 7.1, 192.168.42.38] Couldn’t find module: ti.map

And if you check the Titanium Studio console window you could see something like:

[WARN] :   Called remove for [object view1] on [object contentview], but [object view1] isn’t a child or has already been removed.
[ERROR] :  Script Error {
[ERROR] :      backtrace = “#0 () at :231\n#1 rowSelect() at :54\n#2 () at :90”;
[ERROR] :      line = 13;
[ERROR] :      message = “‘undefined’ is not an object (evaluating ‘Alloy.Globals.Map.createView’)”;
[ERROR] :      name = TypeError;
[ERROR] :      sourceId = 315950496;
[ERROR] :  }

Now, if you want to use maps (as is the module in this example) then what to do? It WILL work if you launch your application directly in the simulator/emulator/device – but then you are back to waiting…

If you read the README file of TiShadow carefully then you will see that you can obtain the wanted effect by adding the modules to the TiShadow app!

You open the tiapp.xml file in your project and on the left side (when in the “Overview” pane) you find “Modules”. Press the “+” sign and select e.g. the ti.map module:
tiapp.xml modules
T
hen you just have to build and run the TiShadow app on the device/simulator/emulator and when it is restarted, connect to your TiShadow server and launch the app you were building that used the “ti.map” module – and it works!

App w map

Sorry, comments are closed for this post.