Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3505] Re-opening a window breaks all event handlers (iOS)

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-06-07T22:57:21.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsdefect, ios
ReporterJohn Johnson
AssigneeIngo Muschenetz
Created2011-04-15T03:46:01.000+0000
Updated2017-06-07T22:57:21.000+0000

Description

Hi

Please see the following code: http://pastie.org/1755281">http://pastie.org/1755281

iOS SDK 4.2, Titanium SDK 1.6.1, Xcode 3.2.5, tested on both the simulator and physical device

I'm trying to create a window that implements a webview with a pageflipper.

My pageflipper fires some custom events using Ti.App.fireEvent( 'nextPage' ); etc., which works amazingly well.

... until I close the window and try to open the window again. Now, my custom events don't get fired. This happens randomly. Sometimes it works the first time, second time, not the third time etc. It always works the first time though.

I think it has something to do with the webview doing a reload() when the window is opening again, which breaks the listener connection (#2641).

My app is ready to be submitted to the App Store but this bug is stalling me. I really need this to be fixed ASAP with some kind of workaround.

Thank you.

Comments

  1. hal 2011-04-15

    John - please state your environment - what Ti / iOS SDK / XCode versions are you using? Have you tested it in the simulator and/or a physical device? Please amend your ticket, adding this information.

    Note the issue does not exist on Android Ti 1.6.1, Android 2.2.

    As the code is short, I've pasted it below (errors fixed):

    app.js:

       var win = Ti.UI.createWindow({backgroundColor:"white"});
       
       var label = Ti.UI.createLabel({
           text: 'Click me',
           color: '#fff',
           width: 'auto',
           height: 'auto'
       });
       
       label.addEventListener( 'click', function() {
       
           var win2 = Ti.UI.createWindow({
               url: 'win2.js',
               zIndex: 2,
               backgroundColor: '#000'
           });
       
           win2.open({
               modal: true
           }); 
       
       });
       
       win.add( label );
       win.open();
       

    win2.js:

       var webview = Ti.UI.createWebView({
           url:"webview.html"
       });
       
       Ti.App.addEventListener("close", function(){
           Ti.UI.currentWindow.close();
       });
       
       Ti.UI.currentWindow.add( webview );
       

    webview.html:

       <html>
       <body>
       <button onClick="Ti.App.fireEvent('close');">Click me to close the window</button>
       </body>
       </html>
       
  2. John Johnson 2011-04-15

    Hi hal,

    I've updated my ticket to reflect my environment. Is it possible to create a workaround or is it indeed a bug?

  3. John Johnson 2011-04-15

    Anything new?

  4. Lee Morris 2017-06-07

    Closing ticket due to time passed.

JSON Source