Problem
A Titnaium class, like Ti.UI.createWindow(), will not be included in the app if deployed to device and file in which it is declared is in the iphone folder.
To reporduce:
1. Create a new app
2. Place this is app.js
var W = {};
Ti.include('mainwindow.js');
W.MainWindow().open();
3. Create a new file and call it mainwindow.js
4. Place this file in the iphone folder (inside of the Resources)
5. Place this code in that file:
W.MainWindow = function(){
var win = Ti.UI.createWindow({
backgroundColor: '#ccc'
});
var map = Ti.Map.createView();
win.add(map)
return {
open: function(args){
args = args || {};
win.open(args);
}
}
}
6. Run the app in the simulator
7. In the sim everything runs fine.
8. Run the app in the real device
9. red screen of death will pop up!
My guess of the source of the problem
- compiler.py - ignoreDirs = ['.git','.svn','_svn','CVS','android','iphone','mobileweb'];
The code gets copied to the final built, but apparently the add_symbol() is never called in those files in the "iphone" dir inside the Resources dir.
Adding environment info - Tested with Titanium SDK: 2.1.1.v20120712160111 Tested with Titanium Studio: 2.1.0.201206251749 Device - iPad 1 iOS 5.1, Simulator Machine OS - MAC 10.7.3