Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Titanium UI components are ignored at compile time when loaded with Helium #4

Open
craigmarvelley opened this issue Jan 17, 2011 · 7 comments

Comments

@craigmarvelley
Copy link

The docs suggest it should be possible to use Helium to create Appcelerator core components within custom component constructors, e.g.

he.register('MyView', function(args) {
    var v = he.create('View');
    var l1 = he.create('Label',{text:'logged out'});
    (snip)
    return v;
});

This works fine when using the simulator (the iPhone simulator, specifically) - because the simulator includes all core modules automatically. However when I build the application for the device, the defines.h file is missing defines for the core components - because the compiler.py file is searching for tokens in the Titanium.UI.create or Ti.UI.create mould. So if an application only creates core components using he.create(), none of those components are available in the build; obviously the application then fails to work.

I can work around this issue by only using the Titanium constructors for core components, but I think functionality like presets will be broken without either patching the complier script to pick up on custom constructors, or allowing custom constructors to be defined on a per-project basis. It'd be nice to keep things consistent, too.

@kwhinnery
Copy link
Owner

d'oh! You're right, of course, the build scripts do indeed look at the contents of your project and omit unused namespaces. I guess all of my Helium projects to date have also included Ti.UI default constructors. I will look into ways to address this, thanks for the report.

@mattlanham
Copy link

I've also discovered this issue, i've made a workaround which basically involves adding all the Ti.UI.create* methods to the end of the helium.js file, when titanium compiles the project it checks all files for the presence of those methods and includes the modules based on usage, so this makes sure everything is included..

Here's a Gist showing what i've done to make it work, hopefully you can include this in future releases to help anyone else...

https://gist.github.com/823294

@aurels
Copy link

aurels commented Mar 4, 2011

Hi,

We've got the same issue and swanify's fix works for us. Please update this ticket if something is changed in Helium to "fix" that ;-)

@mattlanham
Copy link

Recently i've been messing around with android and some of the namespaces i outlined before are not supported for Android, so the code should be adjusted to:

// Titanium doesn't like it if you done use their standard way of creating objects,
// this keeps Titanium nice and happy
Ti.UI.create2DMatrix();
Ti.UI.create3DMatrix();
Ti.UI.createActivityIndicator();
Ti.UI.createAlertDialog();
Ti.UI.createAnimation();
Ti.UI.createButton();
Ti.UI.createButtonBar();
Ti.UI.createEmailDialog();
Ti.UI.createImageView();
Ti.UI.createLabel();
Ti.UI.createOptionDialog();
Ti.UI.createPicker();
Ti.UI.createPickerColumn();
Ti.UI.createPickerRow();
Ti.UI.createProgressBar();
Ti.UI.createScrollView();
Ti.UI.createScrollableView();
Ti.UI.createSearchBar();
Ti.UI.createSlider();
Ti.UI.createSwitch();
Ti.UI.createTab();
Ti.UI.createTabGroup();
Ti.UI.createTableView();
Ti.UI.createTableViewRow();
Ti.UI.createTableViewSection();
Ti.UI.createTextArea();
Ti.UI.createTextField();
Ti.UI.createToolbar();
Ti.UI.createView();
Ti.UI.createWebView();
Ti.UI.createWindow();
Ti.Facebook.createLoginButton();

if(Ti.Platform.osname != "android"){
Ti.UI.createTabbedBar();
Ti.UI.createDashboardView();
Ti.UI.createDashboardItem();
Ti.UI.createCoverFlowView();
}

@IrisHofle
Copy link

I can't thank you guys enough for these instructions. It was painful just getting to the point of figuring out why my app was running on all emulators and the Android device, but nothing on the iPod Touch. Luckily I found that by installing a debug version on the iPod Touch, while connected to the computer and watching the verbose output scrolling in my XCode/Organizer/Device/Console (think Android DDMS output), did I finally see the relationship/connection/misbehaviour between Titanium and helium.js!

@mattlanham
Copy link

No problem glad you got it working!

@cjmyles
Copy link

cjmyles commented Mar 20, 2012

Matt good work on the solution for this, saved me some pain!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants