Titanium Community Questions & Answer Archive

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

Problem with Titanium.App.getVersion on iPad?

Alright, the iPad seems to have a problem with this code:

// INFO BUTTON / TOP RIGHT
var infobutton = Titanium.UI.createButton({
    systemButton:Titanium.UI.iPhone.SystemButton.INFO_LIGHT
});
infobutton.addEventListener('click', function()
{
    Ti.UI.createAlertDialog({title:'App Version', message:'Version: '+Titanium.App.getVersion()+'', buttonNames:['Close']}).show();
});

win.setRightNavButton(infobutton);

Not sure why. Here is the warning that shows in the console:

[WARN] Exception in event callback. {
expressionBeginOffset = 1853;
expressionCaretOffset = 1865;
expressionEndOffset = 1876;
line = 41;
message = "Result of expression 'Titanium.App' [undefined] is not an object.";
name = TypeError;
sourceId = 133443280;
sourceURL = "file://localhost/Users/coltonarabsky/Documents/Stuff/App%20Development/Apps/iPadApp/Resources/main/information.js";
}
— asked September 8th 2010 by Colton Arabsky
  • ipad
0 Comments

4 Answers

  • Seems this problem is only on the Emulator; The page runs fine on an actual iPad.

    — answered September 8th 2010 by Colton Arabsky
    permalink
    0 Comments
  • I'm getting this error as well on the iPhone using the latest build as of today, 1.4.2

    Titanium.App.Properties.setString("my_prop","cool");
    
    message = "Result of expression 'Titanium.App' [undefined] is not an object.";
    name = TypeError;
    sourceId = 244928208;
    
    — answered October 3rd 2010 by Nate Rambarran
    permalink
    0 Comments
  • I am having this same issue when trying to trigger a FireEvent, I just copied some pice of code from the KitchenSink and it does not work on my App.

    This is the code I am trying to use on my App.js

    //
    //  CREATE CUSTOM LOADING INDICATOR
    //
    var indWin = null;
    var actInd = null;
    function showIndicator()
    {
        // window container
        indWin = Titanium.UI.createWindow({
            height:150,
            width:150
        });
    
        // black view
        var indView = Titanium.UI.createView({
            height:150,
            width:150,
            backgroundColor:'#000',
            borderRadius:10,
            opacity:0.8
        });
        indWin.add(indView);
    
        // loading indicator
        actInd = Titanium.UI.createActivityIndicator({
            style:Titanium.UI.iPhone.ActivityIndicatorStyle.BIG,
            height:30,
            width:30
        });
        indWin.add(actInd);
    
        // message
        var message = Titanium.UI.createLabel({
            text:'Loading',
            color:'#fff',
            width:'auto',
            height:'auto',
            font:{fontSize:20,fontWeight:'bold'},
            bottom:20
        });
        indWin.add(message);
        indWin.open();
        actInd.show();
    
    };
    
    function hideIndicator()
    {
        actInd.hide();
        indWin.close({opacity:0,duration:500});
    };
    
    //
    // Add global event handlers to hide/show custom indicator
    //
    Titanium.App.addEventListener('show_indicator', function(e)
    {
        Ti.API.info("IN SHOW INDICATOR");
        showIndicator();
    });
    Titanium.App.addEventListener('hide_indicator', function(e)
    {
        Ti.API.info("IN HIDE INDICATOR");
        hideIndicator();
    });
    
    // trap app shutdown event
    Titanium.App.addEventListener('close',function(e)
    {
        Ti.API.info("The application is being shutdown");
    });
    

    I am getting this error:

    [ERROR] Script Error = Result of expression 'Titanium.App' [undefined] is not an object. at app.js.
    
    — answered October 19th 2010 by Antonio Silveira
    permalink
    0 Comments
  • Yep, you are right, it is a issue just when using the Simulator, when running on the iPad it works.

    — answered October 21st 2010 by Antonio Silveira
    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.