Titanium Community Questions & Answer Archive

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

Error when creating a Titanium.App Listener

Hi, I am trying to define a Global EventListener to fire using FireEvent.
But I am having some trouble in making it to work, don't know why but the same code work on KitchenSink but not on my App. What am I doing Wrong?

Here is the error I am getting:

[ERROR] Script Error = Result of expression 'Titanium.App'
 [undefined] is not an object. at app.js.

And this is the Code that generates this error:

Titanium.App.addEventListener('event1',function(e)
{
    Ti.API.info("Logging Event 1");
});

I am using a continuous 1.5 version of the Mobile SDK, but the same version on KitchenSink works just fine, but not on my App.

Any Ideas?

— asked October 21st 2010 by Antonio Silveira
  • fireevent
  • titanium.app.addeventlistener
0 Comments

4 Answers

  • I had the exact same problem.

    I found that a full rebuild of the script (basically erasing the iphone build folder and recompiling the app) seemed to solve the problem.

    — answered February 7th 2011 by Rj S.
    permalink
    0 Comments
  • I'm sporadically getting the same error. I'm not sure why. After some tries it works again.

    — answered January 6th 2011 by Stephan Lenhart
    permalink
    0 Comments
  • Looks like a linking problem that comes once in a while, I would dare say it's a race condition, though I haven't looked in the Ti source

    — answered January 7th 2011 by Leo Acevedo
    permalink
    0 Comments
  • Simple, just make a Clean in your Project, a full rebuild is necessary to work.

    — answered May 13th 2013 by Luis Fernando Kalfels
    permalink
    0 Comments
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.