Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-18892

iOS: alert or AlertDialog.show on window focus event is called infinite times.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: iOS
    • Environment:

      Tested in titanium SDK 3.5.1 with code written in titanium classic pattern. Same issue also exist on titanium 4.0.0 Beta 2

    • Story Points:
      1

      Description

      When the alert function is called on window focus event the that alert function gets called infinite times, this is because window focus events gets on calling infinite times.

      Another problem is window focus event should not call on calling alert or alertDialog.show()

      Test the code on iOS simulator or device to reproduce bug.

      Below is the code to test the bug, window focus event should not get called infinite times when alert code is written on window focus event.

      Case 1:

      var win1 = Titanium.UI.createWindow(

      { backgroundColor : 'red', title : 'Red Window', }

      );

      var navWin = Titanium.UI.iOS.createNavigationWindow(

      { window : win1 }

      );

      win1.addEventListener("focus",function(e)

      { alert("hello"); Ti.API.info("Focus on first window"); }

      );

      navWin.open();

      Case 2:
      var win1 = Titanium.UI.createWindow(

      { backgroundColor : 'red', title : 'Red Window', }

      );

      var navWin = Titanium.UI.iOS.createNavigationWindow(

      { window : win1 }

      );

      var dialog = Ti.UI.createAlertDialog(

      { cancel: 1, buttonNames: ['Confirm', 'Cancel'], message: 'demo alert dialog?', title: 'Window Option' }

      );

      win1.addEventListener("focus",function(e)

      { dialog.show(); Ti.API.info("Focus on first window"); }

      );

      navWin.open();

      You can copy the cases in app.'s file and test the same. You can also check the debug logs which shows focus event is continuously firing.

      Attached are the files for both the test cases.

      Execute the code to find the bug.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              moizchhatriwala MoizChhatriwala
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-19907
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration