Titanium Community Questions & Answer Archive

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

Invalid method (createToolbar) passed to UIModule on device

Hey. I'm trying to create a toolbar on a modal window and it works well on simulator. But after installing to the device and then it shows the error "invalid method (createToolbar) passed to UIModule on device. The version is Titanium 1.4.2, iOS 4.2, iTouch 2nd generation.

The codes are as following,

  var postWin = Titanium.UI.createWindow({
    url:'../javascripts/post.js',
    title:'New Update'
  }); 
  postWin.open({modal:true,animated:true});

In post.js

var win = Titanium.UI.currentWindow;

var flexSpace = Titanium.UI.createButton({
        systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});

// create and add toolbar
var toolbar1 = Titanium.UI.createToolbar({
        items:[flexSpace],
        bottom:0,
        borderTop:true,
        borderBottom:false,
        translucent:true,
        barColor:'#999'
});     
win.add(toolbar1);

Any guides are welcome. Thanks very much!

— asked December 3rd 2010 by Dingding Ye
  • iphone
  • uimodule
0 Comments

7 Answers

  • One thing to remember is that when you do a full build Titanium removes unused components from their API. So if you are adding a new type of component, for example, there are no textAreas in your app, and then you add a textArea, you may get this error.

    The solution is to force a total rebuild by clearing out the contents of your build/iphone directory

    — answered June 10th 2011 by Tim Alosi
    permalink
    1 Comment
    • this worked for me! :)
      In Titanium Studio, you could also do this: menu > Project > Clean…
      Clean will discard all build problems an built states, the project will be build from scratch.

      — commented December 6th 2011 by Marc Lubbers
  • I had a similar issue, but discovered it was related to Titanium not knowing which modules to include in the build. As I was using Redux, calls such as Titanium.UI.createLabel were not detected by the Titanium builder and thus references to the Label UI module were not included. I wrote some code similar to this to solve the issue:

    (function() {
    var used = [
    Titanium.UI.createActivityIndicator,
    Titanium.UI.createWindow
    ];
    })();

    — answered July 8th 2011 by Matthew ORiordan
    permalink
    2 Comments
    • Matthew… you SAVED me!!! I was stuck for three days swearing…
      Thank you your solution works perfectly!

      — commented January 25th 2012 by Adriano Massi
    • Bizarre issue which I experienced today too.
      The above solution worked fine when I popped it in app.js with my missing Titianium.UI items. I guess this is because I have modules loading in included files and they are not getting picked up anymore ;-x

      Things were working fine until I updated everything to the latest Ti then everything went crazy. Not sure why - built fine on Sim but errors on iPad install. This solution fixed things anyway.

      Many thanks,
      Dave

      — commented December 27th 2012 by david brewer
  • Any word on this, I have spent all day trying to run down this bug also

    — answered December 8th 2010 by Aaron Saunders
    permalink
    0 Comments
  • Oh my days, not quite the same but similar. I am having Invalid method (createWindow) in simulator and cant even install onto device! Whats worse is that it was working last night when I left my development machine - untouched!

    Someone at appcelerator going to pitch in? Hope someone can spread some light on this!

    — answered December 8th 2010 by Ian Tearle
    permalink
    0 Comments
  • i made some progress, if i take the exact same project and put a new app.js in, it works fine… so now I need to see what is wrong with the code in the app.js

    — answered December 8th 2010 by Aaron Saunders
    permalink
    0 Comments
  • I'm also having a similar issue with 1.5.0 and SDK 4.2, was working and now for an unknown reason it doesn't work, if i delete the build folder, run on simulator it works correctly, if i delete the build folder build for device it doesn't work on the device and when i attempt to view in the simulator it also no longer works.

    The errors are:

    [WARN] attempted to load: TiUITabGroupProxy
    [ERROR] Script Error = invalid method (createTabGroup) passed to UIModule at app.js (line 1).
    [ERROR] application received error: invalid method (createTabGroup) passed to UIModule at app.js (line 1)
    [DEBUG] application booted in 275.932014 ms

    — answered December 16th 2010 by Matthew Lanham
    permalink
    2 Comments
    • Is it just me or is this something we as developers should not have to do? I'm hoping the next version of Titanium has a clean & build function.

      — commented March 11th 2011 by Richard John
    • I've exactly the same issue after working 6 weeks on my app without any trouble. I need to submit my app today and it's pretty complicated…

      — commented June 24th 2011 by michel perrin
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.