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?
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.
-
I'm sporadically getting the same error. I'm not sure why. After some tries it works again.
-
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
-
Simple, just make a Clean in your Project, a full rebuild is necessary to work.