Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15020] IOS: App crashes when forcing orientations in NavigationController

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-08-31T00:55:43.000+0000
Affected Version/sRelease 3.1.3, Release 3.2.0
Fix Version/s2013 Sprint 18, 2013 Sprint 18 API, Release 3.1.3, Release 3.2.0
ComponentsiOS
Labelskitchensink, qe-closed-3.1.3, qe-testadded
ReporterVishal Duggal
AssigneeVishal Duggal
Created2013-08-30T22:34:43.000+0000
Updated2014-02-12T09:45:16.000+0000

Description

on iPhone 1. KS->BaseUI->WindowStandalone 2. Rotate to landscape 3. Press Back button. 4. See me crash

Comments

  1. Vishal Duggal 2013-08-30

    Test Case 1 (TAB GROUP)
       //TAB GROUP TEST 1
       var colors = ['white','red','green','blue','teal']
       
       var p = false;
       var ll = false;
       var lr = false;
       var up = false;
       
       var counter = 0;
       function genModes(){
           var modes = [];
           if (p == true) {modes.push(Ti.UI.PORTRAIT)};
           if (ll == true) {modes.push(Ti.UI.LANDSCAPE_LEFT)};
           if (lr == true) {modes.push(Ti.UI.LANDSCAPE_RIGHT)};
           if (up == true) {modes.push(Ti.UI.UPSIDE_PORTRAIT)};
       
           return modes;
       }
       
       function openWin(curWin){
           var theWin = genWindow(genModes());
       
           theWin.addEventListener('open', function(){
               counter ++;
           })
           theWin.addEventListener('close', function(){
               counter --;
           })
           curWin.tab.push(theWin);
       }
       
       function genWindow(modes){
           var temp = counter % 5;
           var win = Ti.UI.createWindow({
               backgroundColor:colors[temp],
               orientationModes:modes,
               layout:'vertical'
           })
       
           var c1 = Ti.UI.createView({
               width:Ti.UI.SIZE,
               height:Ti.UI.SIZE,
               layout:'horizontal',
               top:10
           })
       
           var c2 = Ti.UI.createView({
               width:Ti.UI.SIZE,
               height:Ti.UI.SIZE,
               layout:'horizontal',
               top:10
           })
       
           var c3 = Ti.UI.createView({
               width:Ti.UI.SIZE,
               height:Ti.UI.SIZE,
               layout:'horizontal',
               top:10
           })
       
           var l = Ti.UI.createLabel({
               top:10,
               textAlign:Ti.UI.TEXT_ALIGN_CENTER,
               text:'Window '+counter+' orientationModes '+JSON.stringify(modes)+'.'
           })
           var l1 = Ti.UI.createLabel({
               top:10,
               textAlign:Ti.UI.TEXT_ALIGN_CENTER,
               text:'USE BUTTONS TO TOGGLE FLAGS'
           })
           var l2 = Ti.UI.createLabel({
               top:10,
               textAlign:Ti.UI.TEXT_ALIGN_CENTER,
               text:''
           })
           win.add(l);
           win.add(c1);
           win.add(c2);
           win.add(l2);
           win.add(c3);
       
           var b1 = Ti.UI.createButton({
               title:'PORTRAIT'
           })
           var b2 = Ti.UI.createButton({
               title:'UPSIDE PORTRAIT',
               left:5
           })
           var b3 = Ti.UI.createButton({
               title:'LANDSCAPE_LEFT'
           })
           var b4 = Ti.UI.createButton({
               title:'LANDSCAPE_RIGHT',
               left:5
           })
           c1.add(b1);
           c1.add(b2);
           c2.add(b3);
           c2.add(b4);
       
           b1.addEventListener('click',function(){
               p = !p;
               l2.text = JSON.stringify(genModes());
           })
           b2.addEventListener('click',function(){
               up = !up;
               l2.text = JSON.stringify(genModes());
           })
           b3.addEventListener('click',function(){
               ll = !ll;
               l2.text = JSON.stringify(genModes());
           })
           b4.addEventListener('click',function(){
               lr = !lr;
               l2.text = JSON.stringify(genModes());
           })
       
           b5 = Ti.UI.createButton({
               title:'OPEN'
           })
       
           b7 = Ti.UI.createButton({
               title:'CLOSE',
               left:10
           })
           c3.add(b5);
           if (counter > 0) 
           {
               c3.add(b7);
           };
           
       
           b5.addEventListener('click',function(){openWin(win);});
           b7.addEventListener('click',function(){win.close();});
       
           win.addEventListener('focus',function(){
               p = ll = lr = up = false;
               l2.text = JSON.stringify(genModes());
           });
       
           return win;
       }
       
       
       var rootWindow1 = genWindow(genModes());
       var tab1 = Ti.UI.createTab({
           window:rootWindow1,
           title:'tab1'
       })
       counter++;
       var rootWindow2 = genWindow(genModes());
       var tab2 = Ti.UI.createTab({
           window:rootWindow2,
           title:'tab2'
       })
       counter++;
       var rootWindow3 = genWindow(genModes());
       var tab3 = Ti.UI.createTab({
           window:rootWindow3,
           title:'tab3'
       })
       counter++;
       var rootWindow4 = genWindow(genModes());
       var tab4 = Ti.UI.createTab({
           window:rootWindow4,
           title:'tab4'
       })
       counter++;
       var rootWindow5 = genWindow(genModes());
       var tab5 = Ti.UI.createTab({
           window:rootWindow5,
           title:'tab5'
       })
       counter++;
       var rootWindow6 = genWindow(genModes());
       var tab6 = Ti.UI.createTab({
           window:rootWindow6,
           title:'tab6'
       })
       counter++;
       var tabGrp = Ti.UI.createTabGroup({
           tabs:[tab1,tab2,tab3,tab4,tab5,tab6]
       })
       tabGrp.open();
       
    TEST CASE 2 (NAVIGATION WINDOW)
       //NAV WINDOW TEST
       var colors = ['white','red','green','blue','teal']
       
       var p = false;
       var ll = false;
       var lr = false;
       var up = false;
       
       var counter = 0;
       function genModes(){
           var modes = [];
           if (p == true) {modes.push(Ti.UI.PORTRAIT)};
           if (ll == true) {modes.push(Ti.UI.LANDSCAPE_LEFT)};
           if (lr == true) {modes.push(Ti.UI.LANDSCAPE_RIGHT)};
           if (up == true) {modes.push(Ti.UI.UPSIDE_PORTRAIT)};
       
           return modes;
       }
       
       function openWin(){
           var theWin = genWindow(genModes());
       
           theWin.addEventListener('open', function(){
               counter ++;
           })
           theWin.addEventListener('close', function(){
               counter --;
           })
           navGrp.push(theWin);
       }
       
       function genWindow(modes){
           var temp = counter % 5;
           var win = Ti.UI.createWindow({
               backgroundColor:colors[temp],
               orientationModes:modes,
               layout:'vertical'
           })
       
           var c1 = Ti.UI.createView({
               width:Ti.UI.SIZE,
               height:Ti.UI.SIZE,
               layout:'horizontal',
               top:10
           })
       
           var c2 = Ti.UI.createView({
               width:Ti.UI.SIZE,
               height:Ti.UI.SIZE,
               layout:'horizontal',
               top:10
           })
       
           var c3 = Ti.UI.createView({
               width:Ti.UI.SIZE,
               height:Ti.UI.SIZE,
               layout:'horizontal',
               top:10
           })
       
           var l = Ti.UI.createLabel({
               top:10,
               textAlign:Ti.UI.TEXT_ALIGN_CENTER,
               text:'Window '+counter+' orientationModes '+JSON.stringify(modes)+'.'
           })
           var l1 = Ti.UI.createLabel({
               top:10,
               textAlign:Ti.UI.TEXT_ALIGN_CENTER,
               text:'USE BUTTONS TO TOGGLE FLAGS'
           })
           var l2 = Ti.UI.createLabel({
               top:10,
               textAlign:Ti.UI.TEXT_ALIGN_CENTER,
               text:''
           })
           win.add(l);
           win.add(c1);
           win.add(c2);
           win.add(l2);
           win.add(c3);
       
           var b1 = Ti.UI.createButton({
               title:'PORTRAIT'
           })
           var b2 = Ti.UI.createButton({
               title:'UPSIDE PORTRAIT',
               left:5
           })
           var b3 = Ti.UI.createButton({
               title:'LANDSCAPE_LEFT'
           })
           var b4 = Ti.UI.createButton({
               title:'LANDSCAPE_RIGHT',
               left:5
           })
           c1.add(b1);
           c1.add(b2);
           c2.add(b3);
           c2.add(b4);
       
           b1.addEventListener('click',function(){
               p = !p;
               l2.text = JSON.stringify(genModes());
           })
           b2.addEventListener('click',function(){
               up = !up;
               l2.text = JSON.stringify(genModes());
           })
           b3.addEventListener('click',function(){
               ll = !ll;
               l2.text = JSON.stringify(genModes());
           })
           b4.addEventListener('click',function(){
               lr = !lr;
               l2.text = JSON.stringify(genModes());
           })
       
           b5 = Ti.UI.createButton({
               title:'OPEN'
           })
       
           b6 = Ti.UI.createButton({
               title:'OPEN MODAL',
               left:10
           })
       
           b7 = Ti.UI.createButton({
               title:'CLOSE',
               left:10
           })
           c3.add(b5);
           //c3.add(b6);
           if (counter > 0) 
           {
               c3.add(b7);
           };
           
       
           b5.addEventListener('click',function(){openWin(false);});
           b6.addEventListener('click',function(){openWin(true);});
           b7.addEventListener('click',function(){win.close();});
       
           win.addEventListener('focus',function(){
               p = ll = lr = up = false;
               l2.text = JSON.stringify(genModes());
           });
       
           return win;
       }
       
       
       var rootWindow = genWindow(genModes());
       var navGrp = Ti.UI.iOS.createNavigationWindow({
           window:rootWindow
       })
       counter++;
       navGrp.open();
       
    TEST CASE 3 (PLAIN LIGHTWEIGHT WINDOWS)
       //PLAIN WINDOW TEST
       var isIOS7 = false;
       var version = Titanium.Platform.version.split(".");
       var major = parseInt(version[0],10);
       if (major >= 7) {
           isIOS7 = true;
       }
       
       var colors = ['white','red','green','blue','teal']
       var p = false;
       var ll = false;
       var lr = false;
       var up = false;
       
       var counter = 0;
       function genModes(){
           var modes = [];
           if (p == true) {modes.push(Ti.UI.PORTRAIT)};
           if (ll == true) {modes.push(Ti.UI.LANDSCAPE_LEFT)};
           if (lr == true) {modes.push(Ti.UI.LANDSCAPE_RIGHT)};
           if (up == true) {modes.push(Ti.UI.UPSIDE_PORTRAIT)};
       
           return modes;
       }
       
       function openWin(modal){
           var theWin = genWindow(genModes());
       
           theWin.addEventListener('open', function(){
               counter ++;
           })
           theWin.addEventListener('close', function(){
               counter --;
           })
           theWin.open({modal:modal});
       }
       
       function genWindow(modes){
           var temp = counter % 5;
           var win = Ti.UI.createWindow({
               backgroundColor:colors[temp],
               orientationModes:modes,
               layout:'vertical'
           })
       
           var c1 = Ti.UI.createView({
               width:Ti.UI.SIZE,
               height:Ti.UI.SIZE,
               layout:'horizontal',
               top:10
           })
       
           var c2 = Ti.UI.createView({
               width:Ti.UI.SIZE,
               height:Ti.UI.SIZE,
               layout:'horizontal',
               top:10
           })
       
           var c3 = Ti.UI.createView({
               width:Ti.UI.SIZE,
               height:Ti.UI.SIZE,
               layout:'horizontal',
               top:10
           })
       
           var theTop = 10;
           if (isIOS7) {
               theTop = 30;
           }
       
           var l = Ti.UI.createLabel({
               top:theTop,
               textAlign:Ti.UI.TEXT_ALIGN_CENTER,
               text:'Window '+counter+' orientationModes '+JSON.stringify(modes)+'.'
           })
           var l1 = Ti.UI.createLabel({
               top:10,
               textAlign:Ti.UI.TEXT_ALIGN_CENTER,
               text:'USE BUTTONS TO TOGGLE FLAGS'
           })
           var l2 = Ti.UI.createLabel({
               top:10,
               textAlign:Ti.UI.TEXT_ALIGN_CENTER,
               text:''
           })
           win.add(l);
           win.add(c1);
           win.add(c2);
           win.add(l2);
           win.add(c3);
       
           var b1 = Ti.UI.createButton({
               title:'PORTRAIT'
           })
           var b2 = Ti.UI.createButton({
               title:'UPSIDE PORTRAIT',
               left:5
           })
           var b3 = Ti.UI.createButton({
               title:'LANDSCAPE_LEFT'
           })
           var b4 = Ti.UI.createButton({
               title:'LANDSCAPE_RIGHT',
               left:5
           })
           c1.add(b1);
           c1.add(b2);
           c2.add(b3);
           c2.add(b4);
       
           b1.addEventListener('click',function(){
               p = !p;
               l2.text = JSON.stringify(genModes());
           })
           b2.addEventListener('click',function(){
               up = !up;
               l2.text = JSON.stringify(genModes());
           })
           b3.addEventListener('click',function(){
               ll = !ll;
               l2.text = JSON.stringify(genModes());
           })
           b4.addEventListener('click',function(){
               lr = !lr;
               l2.text = JSON.stringify(genModes());
           })
       
           b5 = Ti.UI.createButton({
               title:'OPEN'
           })
       
           b6 = Ti.UI.createButton({
               title:'OPEN MODAL',
               left:10
           })
       
           b7 = Ti.UI.createButton({
               title:'CLOSE',
               left:10
           })
           c3.add(b5);
           c3.add(b6);
           if (counter > 0) 
           {
               c3.add(b7);
           };
           
       
           b5.addEventListener('click',function(){openWin(false);});
           b6.addEventListener('click',function(){openWin(true);});
           b7.addEventListener('click',function(){win.close();});
       
           win.addEventListener('focus',function(){
               p = ll = lr = up = false;
               l2.text = JSON.stringify(genModes());
           });
       
           return win;
       }
       
       
       openWin(false);
       
  2. Vishal Duggal 2013-08-30

    master - https://github.com/appcelerator/titanium_mobile/pull/4632
  3. Vishal Duggal 2013-08-30

    Backport to 3_1_X - https://github.com/appcelerator/titanium_mobile/pull/4633
  4. Olga Romero 2013-09-03

    Tested the above code as well as KS->BaseUI->WindowStandalone and verified NO crash. Environment: Appcelerator Studio, build: 3.1.3.201308302458 Titanium SDK, build: 3.1.3.v20130902103448 KS[3_1_X] https://github.com/appcelerator-developer-relations/KitchenSink/tree/3_1_X CLI: 3.1.2 Alloy: 1.2.1 Devices: iPad 4 iOS7(11A4449d)

JSON Source