Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16264] iOS: Nav Windows loaded into an iPad SplitView fail to load their child window with message = "Invalid type passed to function"

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2014-01-21T15:20:19.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterStephen Feather
AssigneeIngo Muschenetz
Created2014-01-21T04:50:16.000+0000
Updated2017-03-20T22:04:01.000+0000

Description

Actual Behavior

When loading a SplitWindow from a require in the older 'bootstrapped' styled project structure, the following error occurs:
[ERROR] Script Error {
[ERROR]     backtrace = "#0 () at file:///Users/stephenfeather/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/E597C56F-5A4C-429F-8486-B2E5B89AB74B/testing-classic.app/app.js:2";
[ERROR]     line = 12;
[ERROR]     message = "Invalid type passed to function";
[ERROR]     nativeLocation = "-[TiUIiOSNavWindowProxy rootController] (TiUIiOSNavWindowProxy.m:238)";
[ERROR]     nativeReason = "expected: TiWindowProxy, was: (null)";
[ERROR]     sourceId = 301599424;
[ERROR]     sourceURL = "file:///Users/stephenfeather/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/E597C56F-5A4C-429F-8486-B2E5B89AB74B/testing-classic.app/bootstrap.js";

Expected Behavior

Expect SplitWindow to load NavWindows properly without error.

Observations

Console.logs show that each object and child object seem to be of the proper type,
[INFO]  [object TiUIiPadSplitWindow]
[INFO]  [object TiUIiOSNavWindow]
[INFO]  [object TiUIWindow]
[INFO]  [object TiUIiOSNavWindow]
[INFO]  [object TiUIWindow]
yet it would appear thats not exactly true at the time the NavWindow was created, as the null was received instead of the actual window object. Tickets regarding a similar error with TabGroups appeared around 3.1.3. You can see that the problem exists between the NavWindows and their children, by not opening the splitView, but instead, try to open the NavWindows:
splitWindow.detailView.open();
Opening the child windows, works:
splitWindow.detailView.win.open();
(yeah, I know, odd way to find it)

Test Case

app.js
var app = require('/bootstrap');
app.launch();
bootstrap.js
exports.launch = function(){
	SplitWindow = require('/splitview').tabletMenu;
	var splitWindow = new SplitWindow;

	// Logs to show that objects appear to be of correct types
	console.log(splitWindow);
	console.log(splitWindow.detailView);
	console.log(splitWindow.detailView.win);
	console.log(splitWindow.masterView);
	console.log(splitWindow.masterView.win);
	
	splitWindow.open();
}
splitview.js
exports.tabletMenu = function(){
	var masterWin = Ti.UI.createWindow({
		layout: 'vertical', backgroundColor: '#eee', barColor: '#000000'
	});

	var detailsWin = Ti.UI.createWindow({backgroundColor: '#333'});

	var masterNavWin = Ti.UI.iOS.createNavigationWindow({
		win: masterWin});

	var detailsNavWin = Ti.UI.iOS.createNavigationWindow({
		win: detailsWin
	});

	var self = Ti.UI.iPad.createSplitWindow({
		orientationModes: [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT, Ti.UI.PORTRAIT],
		detailView: detailsNavWin,
		masterView: masterNavWin
	});

	return self;
}

Comments

  1. Ritu Agrawal 2014-01-21

    Moving this ticket to engineering as I can reproduce this issue on iPad simulator with 3.2.0 SDK.
  2. Stephen Feather 2014-01-21

    Bah. createNavigationWindow takes *window* and not *win* for its child. Close this.
  3. Ingo Muschenetz 2014-01-21

    Thanks, Stephen for letting us know. Resolving as invalid based on customer feedback.
  4. Lee Morris 2017-03-20

    Closing ticket as invalid.

JSON Source