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

iOS: Ti.UI.AlertDialog Not Firing Events Consistently (run-on-main-thread)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 7.1.1
    • Component/s: iOS
    • Environment:

      iOS 9.3 (Simulator and real device)
      Titanium SDK 5.5.1+
      XCode 7.3.1
      Studio 4.8.1
      CLI 6.1.0

    • Story Points:
      8
    • Sprint:
      2018 Sprint 06 SDK, 2018 Sprint 07 SDK, 2018 Sprint 08 SDK

      Description

      Alert dialog boxes do not always fire an event. The problem seems exacerbated if one listener is supposed to create another dialog box – although it has been observed with only one alert dialog. It does not seem to matter which option the user selects.

      In the sample app below, the expected behavior is to have text output whenever the user selects an option for dialog A. The actual output is sometimes missing text because the event isn't always firing. Usually, after missing several events, the app completely crashes.

      index.js

      var c = 0;
      function doClick(e) {
          c++;
          var aDialog = Ti.UI.createAlertDialog({
      			cancel: 0,
      			buttonNames: ['Cancel', 'Ok'],
      			message: 'A',
      		});
      		aDialog.addEventListener('click', function(e) {
      			if (e.index == 1) {
      				Ti.API.info(c+' OK');
      				var bDialog = Ti.UI.createAlertDialog({
      					cancel: 0,
      					buttonNames: ['Cancel', 'Ok'],
      					message: 'B'
      				});
      				bDialog.show();
      			} else {
      				Ti.API.info(c+' Cancel.');
      			}
      		});
      		aDialog.show();
      }
      $.index.open();
      

      index.xml

      <Alloy>
      	<Window class="container">
      		<Button id="label" onClick="doClick">Hello, World</Button>
      	</Window>
      </Alloy>
      

      Sample Output

      [DEBUG] :  Application booted in 219.254971 ms
      [INFO] :   1 Cancel.
      [INFO] :   2 OK
      [INFO] :   3 OK
      [INFO] :   4 OK
      [INFO] :   5 Cancel.
      [INFO] :   6 Cancel.
      [INFO] :   7 Cancel.
      [INFO] :   8 OK
      [INFO] :   9 OK
      [INFO] :   10 OK
      [INFO] :   11 Cancel.
      [INFO] :   12 Cancel.
      [INFO] :   13 Cancel.
      [INFO] :   14 Cancel.
      [INFO] :   17 OK
      [INFO] :   18 Cancel.
      [INFO] :   19 OK
      [INFO] :   29 Cancel.
      

        Attachments

        1. index.js
          0.5 kB
        2. index.xml
          0.1 kB
        3. system.log
          257 kB
        4. system-2017-01-27.log
          243 kB

          Activity

            People

            • Assignee:
              hknoechel Hans Knöchel
              Reporter:
              kellycorn Kelly Corn
              Reviewer:
              Vijay Singh
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code