Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23721] iOS: Invalid method (createTabGroup) passed to UIModule

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2016-10-03T19:54:03.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sn/a
ComponentsiOS
Labelsqe-5.4.0
ReporterHarry Bryant
AssigneeHans Knöchel
Created2016-08-03T19:09:46.000+0000
Updated2017-08-16T01:06:37.000+0000

Description

The following error is thrown when calling the createTabGroup method without specifying any tabs:
[WARN] :   Attempted to load TiUITabGroupProxy: Could not find class definition.
[ERROR] :  Script Error {
[ERROR] :      column = 49;
[ERROR] :      line = 1;
[ERROR] :      message = "invalid method (createTabGroup) passed to UIModule";
[ERROR] :      sourceURL = "file:///var/containers/Bundle/Application/4971331A-066C-4C17-BA2D-3DC44E634884/ShamWise.app/app.js";
[ERROR] :      stack = "[native code]\nfile:///var/containers/Bundle/Application/4971331A-066C-4C17-BA2D-3DC44E634884/ShamWise.app/app.js:1:49";
[ERROR] :  }
The issue is resolved when specifying at least one tab as follows:
	 var tabGroup = Ti.UI.createTabGroup();
	 
	 var tab1 = Ti.UI.createTab({
	 	title: "Tab1"
	 });
	 
	 tabGroup.add(tab1); 
	 tabGroup.open();
*This occurs only on the iOS platform, the demo code launches without issue on the Android platform.*

TEST CODE:

	 var tabGroup = Ti.UI.createTabGroup();
	 tabGroup.open();

Steps to Reproduce

1. Create a classic mobile project 2. Include the test code above in the app.js 3. Build to sim / device 4. Launch the app

Actual Result

Error is thrown upon launch.

Expected Result

App should launch an empty tabGroup view without issue.

Comments

  1. Hans Knöchel 2016-08-03

    Wait a second, you are trying to add a tab to the tabgroup that does not hold a window in it. Without it, the tabgroup has no context and could break. Check if that could be the reason. *EDIT*: In addition, it is addTab and not add. *EDIT2*: Ok, here is the thing why it doesn't work for you but me / iOS devs: The above code does not have a tab in it. After some research I found out that our implementation is the following (simplified):
       #ifdef USE_TI_UITAB
       ...
       @implementation TiUITabGroup
       ...
       @end
       #endif
       
    What that does is, that it only compiles the TiUITabGroup class if a TiUITab is defined. Since all compiler-macros are pre-defined in the Xcode source-project, [~cng] and me didn't see the error before. For the compiled SDK, those macros are generically generated as soon as you do Ti.UI.createTab() at least once, we also call it "symbols". So long story short: That is how it is done since forever, since we don't want users to create empty tabgroups. If we want now, we can make it an improvement-ticket, otherwise, that's it.
  2. Hans Knöchel 2016-10-03

    [~htbryant] Resolving for now, since I didn't hear anything back since a while. If you think we need an improvement ticket, I'd be fine with that!
  3. Lee Morris 2017-08-16

    Closing with reference to the above comments.

JSON Source