Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Is Appcelerator Titanium Mobile really a Cross-Compiler?

In the media, blogs and forums Appcelerator Titanium Mobile is often referred to as a "cross-compiler" for mobile applications. It's actually quite hard to find out how the process really goes and what happens in the inside, so I thought I would better ask the source:

Is there real compiling going on for Titanium Mobile during the build process?

Or is it more that you have different packages for every platform that are added to the Javascript code and then interpret it ad-hoc on the device?

There's a good post of your CEO on Stackoverflow on this topic, but this small bit actually isn't answered there or I didn't get it.

Thanks for taking your time to answer!

— asked July 21st 2010 by Jan Piotrowski
  • mobile
0 Comments

2 Answers

  • Accepted Answer

    Jeff's post in the Stack Overflow response is the most technically accurate description of what Titanium is doing to create your app. But if you'll notice, he still indicates that JavaScript code is interpreted on the device (JavaScript being a dynamic language, this is a necessity).

    If you're asking if the JavaScript you write is translated to Objective-C and then compiled, the answer is no - describing Titanium as a cross-compiler is inaccurate in that sense. But based on your usage of Titanium APIs, our build scripts create JavaScript to native code bindings which give JavaScript functions which invoke native functionality almost a 1:1 relationship in terms of performance and functionality.

    — answered July 21st 2010 by Kevin Whinnery
    permalink
    0 Comments
  • From the link you provide : "…we then invoke the SDK compiler (i.e. GCC for iPhone, Java for Android) to then compile your application into the final native binary."

    It compile an app/package/whateverYouWantToNameIt, for each platform. Currently, you can do iPhone and Android or iPad. Eventualy, you'll be able to do iPhone, Android and Blackberry. iPhone and iPad universal binary are on the roadmap for later, but I don't know if it will be one mobile app for all OS or one for iPhone/iPad and one for the remainings…probably not, I hope. They are planning webOS and Windows Phone 7 too I think…not 100% sure about those two.

    So the answer is, iPhone get it's package for AppStore submission and Android get it's own package for Android Market…they are compiled in native languages, not ad-hoc interpreter. You can see that as a code generator (don't throw rocks at me ppl !)…it generates objective C and Java from the Javascript you write, then compile them.

    — answered July 21st 2010 by Jean-Philippe Boily
    permalink
    1 Comment
    • Okay, that's what I thought, too.

      But then I found this presentation in the official blog, slides 22 and 23. There it says "interpreted at runtime" and that JS invokes the native APIs. And this it something different to what is said on StackOverflow. As both sources are Appcelerator, I'm confused.

      — commented July 21st 2010 by Jan Piotrowski
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.