Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14504] LiveView: App doesn't restart properly when a modal window is open

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2015-04-13T16:20:58.000+0000
Affected Version/sRelease 3.1.1
Fix Version/s2013 Sprint 15 Core, 2013 Sprint 15, Release 3.3.0
ComponentsiOS, LiveView
Labelsqe-closed-3.3.0, qe-testadded
ReporterFokke Zandbergen
AssigneeSabil Rahim
Created2013-07-09T19:23:37.000+0000
Updated2015-04-13T16:21:01.000+0000

Description

When a change is triggered while a modal window is open, the other windows are closed, but the modal window remain open. The app also doesn't come back up again and console shows the Client doesn't reconnect either.

Comments

  1. Daniel Sefton 2013-07-09

    Hi Fokke, To help get this solved faster, it would be great if you could provide a simple reproducible test case with a modal window. Thanks!
  2. Christian Sullivan 2013-07-10

    This issue should be assigned to some on the sdk team since this has to do with the restart api process.
  3. Blain Hamon 2013-07-24

    I could recreate this outside of Liveview. Restart was internally passing arguments that caused an exception in how modal windows close. To use: Launch app, click the color button a few times to establish state- Then click modal button, then restart. A successful restart will reset the app to the original window with a red background.
       // this sets the background color of the master UIView (when there are no windows/tab groups on it)
       Titanium.UI.setBackgroundColor('#000');
       var counter = 0;
       var win1 = Titanium.UI.createWindow({backgroundColor:'red'});
       var btn1 = Ti.UI.createButton({top:50,height:50,title:'Window Color'});
       win1.add(btn1);
       btn1.addEventListener('click',function(){
       	var colorArray = ['red','green','blue','yellow','purple'];
       	counter ++;
       	win1.backgroundColor = colorArray[counter];
       });
       
       var btn2 = Ti.UI.createButton({top:110,height:50,title:'modal'});
       win1.add(btn2);
       btn2.addEventListener('click',function(){
       	var win2 = Ti.UI.createWindow({backgroundColor:'white',modal:true});
       	var reloadbtn = Ti.UI.createButton({height:50, title:'restart'});
       	reloadbtn.addEventListener('click',function(){Ti.App._restart();});
       	win2.add(reloadbtn);
       	win2.open();
       });
       
       win1.open();
       
  4. Fokke Zandbergen 2013-12-04

    In what way is this resolved? I only see [~blainhamon]'s comment that he can reproduce it, no comment saying it was fixed or pointing to a PR?
  5. Priya Agarwal 2013-12-17

    Reopening the issue as Now app restart properly when a modal window is open. But if any change is done on modal window then modal window does not gets open on 'modal' button click. Tested Environment: Appcelerator Studio: 3.2.0.201312151544 SDK:3.2.0.v20131216191854 alloy: 1.3.0-cr2 acs: 1.0.10 npm: 1.3.2 titanium: 3.2.0-cr3 titanium-code-processor: 1.1.0-cr2 Xcode:5.0.2 OS: Mac OSX 10.9 Device: Iphone5(v7.0.4)
       
       // this sets the background color of the master UIView (when there are no windows/tab groups on it)
       Titanium.UI.setBackgroundColor('#000');
       var counter = 0;
       var win1 = Titanium.UI.createWindow({backgroundColor:'red',modal:true});
       var btn1 = Ti.UI.createButton({top:50,height:50,title:'Window Color'});
       win1.add(btn1);
       btn1.addEventListener('click',function(){
           var colorArray = ['red','green','blue','yellow','purple'];
           counter ++;
           win1.backgroundColor = colorArray[counter];
       });
        
       var btn2 = Ti.UI.createButton({top:110,height:50,title:'modal'});
       win1.add(btn2);
       btn2.addEventListener('click',function(){
           var win2 = Ti.UI.createWindow({modal:true,backgroundColor:'blue'});
           var reloadbtn = Ti.UI.createButton({height:50, title:'restart'});
           reloadbtn.addEventListener('click',function(){Ti.App._restart();});
           win2.add(reloadbtn);
           win2.open();
       });
        
       win1.open();
       
    Steps to reproduce: 1.Copy paste the code and run the app with liveView enabled. 2.App launches successfully. 3.Tap on window color button. Window color changes as per code. 4.Tap on modal button. Modal window with blue background opens. 5.Tap on restart button. App gets relaunched successfully and previous red background colored window gets open along with two buttons. 6. Now Replace line number 5 with
       var btn1 = Ti.UI.createButton({top:50,height:50,title:'Title changed'});
       
    and save the change. LiveView changes are reflected and app launches with success.Now tap modal button. Modal Window opens. 7. Now change line 16
        var win2 = Ti.UI.createWindow({modal:true,backgroundColor:'yellow'});
       
    and save the change. App launches with success. Now tap modal button. Modal Window does not gets launched. Now when we close the app manually and relaunch the app again then Step 7 also works fine. Hence reopening the bug as any change done on modal window then modal window does not gets open on 'modal' button click.
  6. Sabil Rahim 2013-12-17

    happens in 3.1.2 3.1.3 . The problem seems to occur only when the restart is manually triggered from the button inside the modal view and then if, any of the second window's parameters are changed. There is an console error message also,
       Warning: Attempt to present <UINavigationController: 0x189a9c30> on <UINavigationController: 0x175c83c0> whose view is not in the window hierarchy!
       
    Not a regression , will still keeping looking. On a side note. Opening a modal window on top of a another modal window is not a good test case
  7. Ingo Muschenetz 2013-12-17

    Deferring to 3.2.1 based upon comments.
  8. Ingo Muschenetz 2014-04-07

    [~srahim], update?
  9. Sabil Rahim 2014-04-21

    Actually Cannot Reproduce the issue with latest 3.3.0 master(April 21). Code Used
       // this sets the background color of the master UIView (when there are no windows/tab groups on it)
       Titanium.UI.setBackgroundColor('#000');
       var counter = 0;
       var win1 = Titanium.UI.createWindow({backgroundColor:'red',modal:true});
       var btn1 = Ti.UI.createButton({top:50,height:50,title:'Window Color'});
       win1.add(btn1);
       btn1.addEventListener('click',function(){
           var colorArray = ['red','green','blue','yellow','purple'];
           counter ++;
           win1.backgroundColor = colorArray[counter];
       });
         
       var btn2 = Ti.UI.createButton({top:110,height:50,title:'modal'});
       win1.add(btn2);
       btn2.addEventListener('click',function(){
           var win2 = Ti.UI.createWindow({modal:true,backgroundColor:'blue'});
           var reloadbtn = Ti.UI.createButton({height:50, title:'restart'});
           reloadbtn.addEventListener('click',function(){Ti.App._restart();});
           win2.add(reloadbtn);
           win2.open();
       });
         
       win1.open();
       
  10. Neha Mittal 2014-04-23

    Verified fix with below environment: Appc Studio: 3.3.0.201404211130 SDK build: 3.3.0.v20140422163054 acs: 1.0.14 npm: 1.3.2 alloy: 1.4.0-dev CLI: titanium-3.3.0-dev titanium-code-processor:1.1.1-beta1 Xcode: 5.1.1 Osx: Mavericks(10.9.2) LiveView is working as expected. Changes are reflected on the Modal window. Hence Closing the issue.

JSON Source