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;
}
Moving this ticket to engineering as I can reproduce this issue on iPad simulator with 3.2.0 SDK.
Bah. createNavigationWindow takes *window* and not *win* for its child. Close this.
Thanks, Stephen for letting us know. Resolving as invalid based on customer feedback.
Closing ticket as invalid.