Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2600] iOS: invalid method (createTabGroup) passed to UIModule at app.js

GitHub Issuen/a
TypeBug
PriorityLow
StatusResolved
ResolutionCannot Reproduce
Resolution Date2019-11-20T21:38:36.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsiOS
Labelscore
ReporterMatthew Lanham
AssigneeIngo Muschenetz
Created2011-04-15T03:24:05.000+0000
Updated2019-11-20T21:38:36.000+0000

Description

When i build for simulator everything works as expected, but when i build for device it installs onto the phone, then when i open the application the errors below appear and the app locks on the splash screen. I've really tried everything and it looks like a couple of other people have experienced similar issues:

http://developer.appcelerator.com/question/85671/invalid-method-createtoolbar-passed-to-uimodule-on-device"> http://developer.appcelerator.com/question/85671/invalid-method-cre...
http://developer.appcelerator.com/question/45181/test-working-in-ipad-simulator-not-on-ipad"> http://developer.appcelerator.com/question/45181/test-working-in-ip...

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

This issue has just started and i'm struggling to move past it, i've done the following and it's still causing the issue:

  • Uninstalled titanium from my system, user folder, application support folder etc
  • Reinstalled everything
  • Removed build folder
  • Created a new user account on my mac
  • Repeated above steps
  • Created new project etc

I've attached my app.js which seems to be in order, i also created a new project and replaced the app.js in that project and it seemed to run ok, but i cannot find any reason why my app.js wouldn't run...

please help, i've spent 2 whole days trying things now!!!!!

Attachments

FileDateSize
app.js2011-04-15T03:24:05.000+00001990

Comments

  1. Craig Marvelley 2011-04-15

    I'm experiencing this issue too, and I can't find a workaround. I'm seeing it with both 1.5.1 and 1.4.2 SDKs. Since it seems to only be an issue when compiling for a device, and I'm only seeing this issue for tab groups (a straightforward app.js that loads a single window works, while the same code but with a tab group doesn't) I found all files within the build directory that seem to reference a tab group. There are differences between a simulator build and a device build, but I'll leave it to you to decide if that's unnatural. Just thought this might be useful!

    Mentions of TabGroup in my simulator build (iOS 4.2, SDK 1.5.1)

    Classes/TiTab.h
    Classes/TiTabGroup.h
    Classes/TiUIOptionDialogProxy.m
    Classes/TiUITabGroup.h
    Classes/TiUITabGroup.m
    Classes/TiUITabGroupProxy.h
    Classes/TiUITabGroupProxy.m
    Classes/TiUITabProxy.h
    Classes/TiUITabProxy.m
    Classes/TiUIWindowProxy.m
    Classes/TiWindowProxy.h
    Classes/TiWindowProxy.m
    MyApp.xcodeproj/project.pbxproj
    build/build.log
    build/Debug-iphonesimulator/MyApp.app/MyApp
    build/Debug-iphonesimulator/MyApp.app.dSYM/Contents/Resources/DWARF/MyApp
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/build-state.dat
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/build-state~.dat
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiUIOptionDialogProxy.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiUITabController.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiUITabGroup.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiUITabGroupProxy.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiUITabProxy.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiUIWindowProxy.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiWindowProxy.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp-project-headers.hmap
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp.dep
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp.hmap
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp~.dep

    Mentions of TabGroup in my device build (same targets)

    Classes/TiTab.h
    Classes/TiTabGroup.h
    Classes/TiUIOptionDialogProxy.m
    Classes/TiUITabGroup.h
    Classes/TiUITabGroup.m
    Classes/TiUITabGroupProxy.h
    Classes/TiUITabGroupProxy.m
    Classes/TiUITabProxy.h
    Classes/TiUITabProxy.m
    Classes/TiUIWindowProxy.m
    Classes/TiWindowProxy.h
    Classes/TiWindowProxy.m
    MyApp.xcodeproj/project.pbxproj
    build/build.log
    build/Debug-iphonesimulator/MyApp.app/MyApp
    build/Debug-iphonesimulator/MyApp.app.dSYM/Contents/Resources/DWARF/MyApp
    build/Release-iphoneos/MyApp.app/MyApp
    build/Release-iphoneos/MyApp.app.dSYM/Contents/Resources/DWARF/MyApp
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/build-state.dat
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/build-state~.dat
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiUITabGroup.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiUITabGroupProxy.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiUIWindowProxy.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/TiWindowProxy.o
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp-project-headers.hmap
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp.dep
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp.hmap
    build/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp~.dep
    build/MyApp.build/Release-iphoneos/MyApp.build/build-state.dat
    build/MyApp.build/Release-iphoneos/MyApp.build/build-state~.dat
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv6/MyApp
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv6/MyApp.LinkFileList
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv6/TiUITabGroup.o
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv6/TiUITabGroupProxy.o
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv6/TiUIWindowProxy.o
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv6/TiWindowProxy.o
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv7/MyApp
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv7/MyApp.LinkFileList
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv7/TiUITabGroup.o
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv7/TiUITabGroupProxy.o
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv7/TiUIWindowProxy.o
    build/MyApp.build/Release-iphoneos/MyApp.build/Objects-normal/armv7/TiWindowProxy.o
    build/MyApp.build/Release-iphoneos/MyApp.build/MyApp-project-headers.hmap
    build/MyApp.build/Release-iphoneos/MyApp.build/MyApp.dep
    build/MyApp.build/Release-iphoneos/MyApp.build/MyApp.hmap
    build/MyApp.build/Release-iphoneos/MyApp.build/MyApp~.dep

    I'd really appreciate a fix or a workaround for this, since it's pretty much a showstopper for us.

    Cheers,
    Craig

  2. Craig Marvelley 2011-04-15

    I've found the issue, but not the cause. The defines.h file is missing includes for all the titanium UI components I'm using in the application. When running the code in the simulator all components are included by default, whereas when building for a device the includes are done dynamically. What's probably happening is Titanium isn't picking up on the use of the modules in the code, and not including them in the file.

    Are you using the helium library by any chance? I'm wondering if that, or its advocated practice of loading components in a separate scope, is contributing to this issue.

  3. Matthew Lanham 2011-04-15

    When we debugged this issue and messed around for ages with it, we found it was because we didn't have a tab in place, our app wasn't using tabs to begin with and this seemed to cause issues, we put some tabs in and everything went back to normal...

  4. Craig Marvelley 2011-04-15

    Yeah, I think I've the same problem but with a different cause - I'm adding tabs to the group but not in the global scope, and it doesn't look like they're being picked up.

  5. Jesus H. Christ 2011-04-15

    This is a limitation of the compiler when you don't explicitly use createTab in your code, but can be worked around.

    The bundler tries to only include modules that it needs to in order to keep the footprint of your app relatively small (in file-size). In order to do this, the compiler tries to determine what modules you are using in your project and only includes those in the final .app package. It looks for Titanium 'create' functions (such as createButton, createLabel, createTabGroup, createTableView, etc.).

    In a normal project where you do something along the lines:

       Ti.UI.createTableView(...);
       Ti.UI.createTabGroup();
       Ti.UI.createTab({...});
       Ti.UI.createTab({...});
       Ti.UI.createTab({...});
       

    Based on the parsing mechanism that it uses, the compiler comes away with the following unique modules:

    • TABLEVIEW
    • TABGROUP
    • TAB

    However, the class files for all the tab class files checks for just TAB (not TABGROUP)... as seen here from TiUITabGroupProxy.h:

       #ifdef USE_TI_UITAB
       #endif
       

    ...so unless you explicitly call TI.UI.createTab(...) in your code somewhere, you will run into this issue.

    An easy solution would be to put:

       Ti.UI.createTabGroup;
       

    Somewhere in your app.js file.

    The permanent fix would be to change the compiler to merge TAB and TABGROUP into one, or change the header files to respect either constant (USE_TI_UITAB || USE_TI_UITABGROUP).

    -JRo.

  6. Daniel Arroyo 2011-04-15

    I have the same problem. After building a hw build my defines.h becomes like this:

    // Warning: this is generated file. Do not modify!

    define TI_VERSION 1.6.1

    define USE_TI_ANALYTICS 1

    define USE_TI_NETWORK 1

    define USE_TI_PLATFORM 1

    define USE_TI_UI 1

    define USE_TI_INCLUDE 1

    define USE_TI_UIALERTDIALOG 1

    define USE_TI_API 1

    define USE_TI_APIINFO 1

    define USE_TI_PLATFORMID 1

    define USE_TI_NETWORKHTTPCLIENT 1

    I'm using Titanium 1.6.1, XCode 4 for the iPhone

  7. Daniel Arroyo 2011-04-15

    even more info:

    It seems that I was able to fix this by taking my code out of the /Resources/iphone directory into the /Resources directory.

    I'm guessing this is regression for 1.6.1 ?

  8. Stephen Tramer 2012-05-03

    Sample code is incomplete. With some modifications was unable to reproduce on master (2.1.0.848d711).
  9. Dustin Hyde 2012-08-14

    OS: Mac OS X Lion 10.7.4 Titanium Studio, build: 2.1.1.201208091713 Titanium SDK, build: 2.2.0.v20120813184911; 2.1.1.GA; 2.0.2.GA Running app on devices (iPad 2 (5.1.1) and iPhone 4 (4.3.5)) gets an Application Error "invalid method (create TabGroup) passed to UIModule at app.js (line 2)" iOS console log: [ERROR] Script Error = invalid method (createTabGroup) passed to UIModule at app.js (line 2). Test Code:
       var win = Ti.UI.createWindow();
       var tabGroup = Ti.UI.createTabGroup();
       var label = Ti.UI.createLabel();
       var x = {};
        
       x.win = win;
       tabGroup.win = win;
       label.win = win;
       win.win = win;
       win.tabGroup = tabGroup;
       label.tabGroup = tabGroup;
       x.tabGroup = tabGroup;
       tabGroup.tabGroup = tabGroup;
        
       Ti.API.info('x.win == ' + x.win);
       Ti.API.info('tabGroup.win == ' + tabGroup.win);
       Ti.API.info('label.win == ' + label.win);
       Ti.API.info('win.win == ' + win.win);
       Ti.API.info('win.tabGroup == ' + win.tabGroup);
       Ti.API.info('label.tabGroup == ' + label.tabGroup);
       Ti.API.info('x.tabGroup == ' + x.tabGroup);
       Ti.API.info('tabGroup.tabGroup == ' + tabGroup.tabGroup);
        
       alert('View Log Info...');
       
  10. Junaid Younus 2012-08-23

    Tested Dustin's code on the iOS simulator using TiSDK 2.2.0v20120821095711, I get the following console output:
        [INFO] x.win == [object TiUIWindow]
        [INFO] tabGroup.win == [object TiUIWindow]
        [INFO] label.win == [object TiUIWindow]
        [INFO] win.win == [object TiUIWindow]
        [INFO] win.tabGroup == undefined
        [INFO] label.tabGroup == [object TiUITabGroup]
        [INFO] x.tabGroup == [object TiUITabGroup]
        [INFO] tabGroup.tabGroup == undefined
        
  11. Manojkumar Murugesan 2016-01-28

    Occurs when TabGroup / Tab components are declared using $.UI.create and not using XML / Ti.UI.create method.
  12. Alan Hutton 2019-11-20

    Closing. Unable to reproduce. Axway Appcelerator Studio, build: 5.1.4.201909061933  macOS : 10.14.6 Node.js Version : 8.9.1 npm Version : 5.5.1 Appcelerator CLI : 7.1.1 Titanium CLI CLI Version : 5.2.1 node-appc Version : 0.2.49 Titanium SDKs : 8.2.0.GA

JSON Source