Search code examples
titaniumtitanium-alloytitanium-modulestitanium-android

Console.log giving error in Titanium Android App


I am getting error in Titanium App, where I am trying to see the object or data in a variable mainwin

I wrote only these lines for debugging, and then I am getting error

Screenshot :

enter image description here)

console.log(mainwin);
console.log(e);

Solution

  • Some titanium objects cannot be serialized to console using toJSON() method.

    That's because the parent object (Ti.UI.Window) has references to the child objects. The child objects also keep references to the parent object. That's why you're getting circular dependency.

    You can run your code in debug mode from Titanium Studio and place some breakpoints (that's working 90% of the time). Alternatively you could narrow down the object you want to explore and log it to console.