{ "id": "165479", "key": "TIMOB-24349", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "20102", "name": "Release 7.1.1", "archived": false, "released": true, "releaseDate": "2018-05-02" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-04-12T15:44:45.000+0000", "created": "2017-01-25T21:55:48.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "ios", "qe-6.2.0", "run-on-main-thread" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-06-19T13:55:56.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "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. \r\n\r\nIn 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.\r\n\r\n*index.js*\r\n{code:java}\r\nvar c = 0;\r\nfunction doClick(e) {\r\n c++;\r\n var aDialog = Ti.UI.createAlertDialog({\r\n\t\t\tcancel: 0,\r\n\t\t\tbuttonNames: ['Cancel', 'Ok'],\r\n\t\t\tmessage: 'A',\r\n\t\t});\r\n\t\taDialog.addEventListener('click', function(e) {\r\n\t\t\tif (e.index == 1) {\r\n\t\t\t\tTi.API.info(c+' OK');\r\n\t\t\t\tvar bDialog = Ti.UI.createAlertDialog({\r\n\t\t\t\t\tcancel: 0,\r\n\t\t\t\t\tbuttonNames: ['Cancel', 'Ok'],\r\n\t\t\t\t\tmessage: 'B'\r\n\t\t\t\t});\r\n\t\t\t\tbDialog.show();\r\n\t\t\t} else {\r\n\t\t\t\tTi.API.info(c+' Cancel.');\r\n\t\t\t}\r\n\t\t});\r\n\t\taDialog.show();\r\n}\r\n$.index.open();\r\n{code}\r\n\r\n*index.xml*\r\n\r\n{code:java}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n*Sample Output*\r\n{code:java}\r\n[DEBUG] : Application booted in 219.254971 ms\r\n[INFO] : 1 Cancel.\r\n[INFO] : 2 OK\r\n[INFO] : 3 OK\r\n[INFO] : 4 OK\r\n[INFO] : 5 Cancel.\r\n[INFO] : 6 Cancel.\r\n[INFO] : 7 Cancel.\r\n[INFO] : 8 OK\r\n[INFO] : 9 OK\r\n[INFO] : 10 OK\r\n[INFO] : 11 Cancel.\r\n[INFO] : 12 Cancel.\r\n[INFO] : 13 Cancel.\r\n[INFO] : 14 Cancel.\r\n[INFO] : 17 OK\r\n[INFO] : 18 Cancel.\r\n[INFO] : 19 OK\r\n[INFO] : 29 Cancel.\r\n{code}\r\n\r\n", "attachment": [ { "id": "61323", "filename": "index.js", "author": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "created": "2017-01-25T21:55:04.000+0000", "size": 507, "mimeType": "text/javascript" }, { "id": "61322", "filename": "index.xml", "author": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "created": "2017-01-25T21:55:05.000+0000", "size": 116, "mimeType": "text/xml" }, { "id": "61330", "filename": "system.log", "author": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "created": "2017-01-26T17:03:19.000+0000", "size": 262906, "mimeType": "text/plain" }, { "id": "61335", "filename": "system-2017-01-27.log", "author": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "created": "2017-01-27T18:25:46.000+0000", "size": 248462, "mimeType": "text/plain" } ], "flagged": false, "summary": "iOS: Ti.UI.AlertDialog Not Firing Events Consistently (run-on-main-thread)", "creator": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "subtasks": [], "reporter": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "environment": "iOS 9.3 (Simulator and real device)\r\nTitanium SDK 5.5.1+\r\nXCode 7.3.1\r\nStudio 4.8.1\r\nCLI 6.1.0", "closedSprints": [ { "id": 1018, "state": "closed", "name": "2018 Sprint 07 SDK", "startDate": "2018-03-25T21:59:36.637Z", "endDate": "2018-04-08T21:59:00.000Z", "completeDate": "2018-04-08T17:55:14.467Z", "originBoardId": 114 }, { "id": 1021, "state": "closed", "name": "2018 Sprint 08 SDK", "startDate": "2018-04-08T17:57:36.122Z", "endDate": "2018-04-22T17:57:00.000Z", "completeDate": "2018-04-22T22:51:19.120Z", "originBoardId": 114 }, { "id": 1008, "state": "closed", "name": "2018 Sprint 06 SDK", "startDate": "2018-03-11T22:18:04.396Z", "endDate": "2018-03-25T22:18:00.000Z", "completeDate": "2018-03-25T21:52:36.683Z", "originBoardId": 216 } ], "comment": { "comments": [ { "id": "405362", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey there,\r\n\r\ntested the issue with 20+ clicks and both main-thread enabled ({{true}}) and not. Both worked fine for me. The tests have been done on the iOS 10.2 Simulator.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-26T08:53:48.000+0000", "updated": "2017-01-26T08:53:48.000+0000" }, { "id": "405386", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I can also test the issue. Works for me too. ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-01-26T15:21:35.000+0000", "updated": "2017-01-26T15:21:35.000+0000" }, { "id": "405388", "author": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Also seeing this behavior on all SDKs after 5.3.1", "updateAuthor": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-26T15:46:41.000+0000", "updated": "2017-01-26T15:46:41.000+0000" }, { "id": "405389", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~cliff_stander] So it did not happen on 5.3.0 or 5.2.x? That would help greatly! *EDIT*: Just checked the commits, I can't see any related change to the alert dialog that might have caused it. If someone can provide an exact SDK version from which it happened (and probably a more detailed test-case), we have good chances to fix it! Maybe it only happens on iOS 9 devices? Or only sims/devices? More info is crucial for this one.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-26T15:48:50.000+0000", "updated": "2017-01-26T15:51:48.000+0000" }, { "id": "405390", "author": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "body": "correct 5.3.1 and 5.2.x work but 5.4.0, 5.5.1, 6.0.1 all have this issue. It's intermittent, sometimes working many times in a row before failing, seems to only be iOS, Android seems unaffected.", "updateAuthor": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-26T15:52:11.000+0000", "updated": "2017-01-26T15:52:11.000+0000" }, { "id": "405391", "author": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Just happened to me with the sample code using iOS 8.4 Sim (ipad 2) and again seeing it happen on ipad 2 iOS 9.3", "updateAuthor": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-26T15:54:57.000+0000", "updated": "2017-01-26T15:56:52.000+0000" }, { "id": "405392", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~cliff_stander] Did you test this on iOS 10 or later? And using main-thread on/off?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-26T15:56:22.000+0000", "updated": "2017-01-26T15:56:22.000+0000" }, { "id": "405393", "author": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "body": "ipad air iOS 10.1 just recreated, run-on-main-thread = true", "updateAuthor": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-26T16:00:03.000+0000", "updated": "2017-01-26T16:00:03.000+0000" }, { "id": "405394", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "The only AlertDialog related change in 5.4.0 is TIMOB-20550 (should not be related, only auto-layout). If you could log the full error when crashing, we could track it down easily.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-26T16:05:11.000+0000", "updated": "2017-01-26T16:05:11.000+0000" }, { "id": "405395", "author": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I have not yet seen the crash, but will send it in if I do", "updateAuthor": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-26T16:07:06.000+0000", "updated": "2017-01-26T16:07:06.000+0000" }, { "id": "405396", "author": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I have modified the code to add clicks to the counter after saying ok to \"A\" so we can see when \"B\" fails, as Kelly stated it happens more on the second listener, in a 10. ipad air sim I had it fail 3 times out of 80 clicks 2/3 were on the second level message.\r\n\r\n\r\n{code:java}\r\nvar c = 0;\r\nfunction doClick(e) {\r\n c++;\r\n var aDialog = Ti.UI.createAlertDialog({\r\n cancel: 0,\r\n buttonNames: ['Cancel', 'Ok'],\r\n message: 'A',\r\n });\r\n \r\n aDialog.addEventListener('click', function(e) {\r\n if (e.index == 1) {\r\n Ti.API.info(c+' OK');\r\n c++;\r\n var bDialog = Ti.UI.createAlertDialog({\r\n cancel: 0,\r\n buttonNames: ['Cancel', 'Ok'],\r\n message: 'B'\r\n});\r\n\t\t\t\t\r\n bDialog.addEventListener('click', function(e) {\r\nif (e.index == 1) {\r\nTi.API.info(c+' OK - b');\r\n} else {\r\nTi.API.info(c+' Cancel - b');\r\n}});\r\n\t\t\t\t\r\nbDialog.show();\r\n} else {\r\n Ti.API.info(c+' Cancel.');\r\n}\r\n});\r\naDialog.show();\r\n}\r\n$.index.open();\r\n{code}\r\n", "updateAuthor": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-26T16:23:17.000+0000", "updated": "2017-01-26T16:25:27.000+0000" }, { "id": "405401", "author": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "body": "Here is a system.log with a crash.", "updateAuthor": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "created": "2017-01-26T17:04:02.000+0000", "updated": "2017-01-26T17:04:02.000+0000" }, { "id": "405481", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ok, the error helps a lot! Until I am able to reproduce it, can you try to modify the {{TiUIAlertDialogProxy.m}} method {{fireClickEventWithAction}} with\r\n{code:objc}\r\nTiThreadPerformOnMainThread(^{\r\n [self fireEvent:@\"click\" withObject:event];\r\n}, YES);\r\n{code}\r\ninstead of\r\n{code:objc}\r\n[self fireEvent:@\"click\" withObject:event];\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-27T11:37:52.000+0000", "updated": "2017-01-27T11:37:52.000+0000" }, { "id": "405505", "author": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "body": "Hans, I made the change, and did not see much improvement. I am attaching a second log for you with another crash.", "updateAuthor": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "created": "2017-01-27T18:26:22.000+0000", "updated": "2017-01-27T18:26:22.000+0000" }, { "id": "405509", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "And you applied the change to {{~/Library/Application Support/Titanium/mobilesdk/osx/6.0.1.GA/iphone/Classes/TiUIAlertDialog.m}} + did a fresh build? And did it help to not use main-thread (property above to false)?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-27T18:37:02.000+0000", "updated": "2017-01-27T18:37:02.000+0000" }, { "id": "405522", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "And next attempt: If you comment-out the {{[self cleanup];}} call, does that change something? The error suggests that a proxy reference has been GC'd from memory before sending out the event and it's required to assign the {{source}} property but also to delegate the event through the app lifecycle to deliver it to the assigned event listener. Just a little background, not too relevant for you guys I guess. But please to comment it out and see what happens. If it's that one, I have an idea to fix it.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-27T19:27:14.000+0000", "updated": "2017-01-27T19:27:14.000+0000" }, { "id": "405532", "author": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "body": "Hans- making the first change you suggested to TiUIAlertDialog.m and setting run-on-main-thread to false seems to have fixed the issue (my previous attempt was set to true). I went through 100 dialogs with no missed events and no crashes, and also tested our own app where the issue was quite visible - all seemed much better. Do you still need input on the deletion of [self cleanup]?", "updateAuthor": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "created": "2017-01-27T20:16:40.000+0000", "updated": "2017-01-27T20:16:40.000+0000" }, { "id": "422541", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey [~kellycorn], sorry for the delay! Unfortunately I have still not been able to reproduce it, so I have to troubleshoot you some more ideas: Can you do one last thing and replace the {{fireClickEventWithAction}} method with [this one|https://gist.github.com/hansemannn/5512e4534f2c3f7fd19a7c986e7c1cf0]? It will basically ensure that the click event is fired before the cleanup is initiated. I have also attached the log of 81 click-tests that all passed. Thank you!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-06-22T08:00:21.000+0000", "updated": "2017-06-22T08:00:31.000+0000" }, { "id": "423127", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~hknoechel] I tried your solution, it crashed me sometimes and event failed as well. As [~kellycorn] has verified that event in case of Kroll Thread (run_on_main-thread = false) is working fine. I checked memory allocation of TiUIAlertViewProxy for main thread and kroll thread. Heap size decrease very frequently in case of kroll thread and decrease after long time in case of main thread. I observed that when large size of heap is getting released, in that case event got missed. So I released heap forcefully in case of main thread using -\r\n\r\n{code:java}\r\n#ifndef TI_USE_KROLL_THREAD\r\n KrollContext *krollContext = [self.pageContext krollContext];\r\n [krollContext forceGarbageCollectNow];\r\n#endif\r\n{code}\r\n \r\ninside -(void)show:(id)args method of TIUIAlertViewProxy.m as mentioned [here|https://gist.github.com/vijaysingh-axway/af115c27a92b63f77808126ebea40535].\r\n\r\n[~hknoechel] and [~kellycorn] can you guys please verify with your use cases. \r\n", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-06-29T09:57:11.000+0000", "updated": "2017-06-29T09:59:09.000+0000" }, { "id": "423211", "author": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "body": "Vijay- I verified your change to release the heap and had 100 / 100 events fire successfully! (note: I am now using SDK 6.1.1)", "updateAuthor": { "name": "kellycorn", "key": "kellycorn", "displayName": "Kelly Corn", "active": true, "timeZone": "America/Denver" }, "created": "2017-06-29T22:13:49.000+0000", "updated": "2017-06-29T22:15:53.000+0000" }, { "id": "423231", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks [~kellycorn].\r\n\r\n\r\nPR: https://github.com/appcelerator/titanium_mobile/pull/9181", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-06-30T04:54:38.000+0000", "updated": "2017-06-30T04:54:38.000+0000" }, { "id": "423263", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, using the sample app provided, AlertDialog events fired successfully 100 / 100 times. Tested on both Simulator and Device.\r\n\r\nTested On:\r\niPhone 7 10.3.2 Device & Simulator\r\nMac OS Sierra (10.12.5)\r\nTi SDK: 6.2.0.v20170630052324\r\nAppc NPM: 4.2.9\r\nApp CLI: 6.2.2\r\nXcode 8.3.3\r\nNode v4.6.0\r\n\r\n*Closing ticket.*", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2017-06-30T13:43:03.000+0000", "updated": "2017-06-30T13:43:03.000+0000" }, { "id": "430342", "author": { "name": "appsol", "key": "appsol", "displayName": "Muhammad Qasim", "active": true, "timeZone": "Asia/Karachi" }, "body": "I am still experiencing this issue on SDKs 6.2.0.GA and 6.3.0.GA with {{run-on-main-thread = true}} on iOS 11.1 simulator. If I set {{run-on-main-thread = false}} then the click listener is fired twice.", "updateAuthor": { "name": "appsol", "key": "appsol", "displayName": "Muhammad Qasim", "active": true, "timeZone": "Asia/Karachi" }, "created": "2017-11-09T07:45:48.000+0000", "updated": "2017-11-09T07:45:48.000+0000" }, { "id": "433588", "author": { "name": "dbenhenni", "key": "dbenhenni", "displayName": "dbenhenni", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I am dealing with the same issue on SDKs 7.0.0.GA. Problem is fixed with run-on-main-thread=false the click listener is fired correctly. But that is no option for me. I need to run my app on main thread.", "updateAuthor": { "name": "dbenhenni", "key": "dbenhenni", "displayName": "dbenhenni", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-24T14:13:39.000+0000", "updated": "2018-01-24T14:13:39.000+0000" }, { "id": "433589", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~vijaysingh] Can you revisit this ticket and write a stress-test?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-24T14:28:33.000+0000", "updated": "2018-01-24T14:28:33.000+0000" }, { "id": "433703", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": " I tried with test case mentioned in this ticket and unable to reproduce the issue.\r\n[~appsol] [~dbenhenni] Can you please share your test cases? Thanks!", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-26T08:19:01.000+0000", "updated": "2018-01-26T08:19:01.000+0000" }, { "id": "434057", "author": { "name": "reymundolopez", "key": "reymundolopez", "displayName": "Reymundo López", "active": true, "timeZone": "America/Mexico_City" }, "body": "Still seeing this issue on 7.0.1.GA, only happens when {{run-on-main-thread = true}}, [~hknoechel] the weirdest thing is, there is no crash and no log for this, just silently don't fire the listener", "updateAuthor": { "name": "reymundolopez", "key": "reymundolopez", "displayName": "Reymundo López", "active": true, "timeZone": "America/Mexico_City" }, "created": "2018-02-05T18:41:22.000+0000", "updated": "2018-02-05T18:41:22.000+0000" }, { "id": "434069", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~reymundolopez] Is this issue happening with test case mentioned in this ticket? I am not able to reproduce at my end. Can you please share your test case? Thanks!", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-06T00:14:17.000+0000", "updated": "2018-02-06T00:14:17.000+0000" }, { "id": "434075", "author": { "name": "dbenhenni", "key": "dbenhenni", "displayName": "dbenhenni", "active": true, "timeZone": "America/Los_Angeles" }, "body": "In my case it is an optionDialog. The result is the same. Here is a quick example code. Click several times and see what happens.\r\n\r\n{code:java}\r\n// -- confirm function -------------------------------------------------------\r\nUI.confirm = function(msg, callback, selectedButton, buttons) {\r\n\tvar opts = {\r\n\t\toptions : buttons,\r\n\t\tselectedIndex : ( selectedButton ? selectedButton : null ),\r\n\t\t//destructive : 1, <- tested with and without destructive. No difference.\r\n\t\ttitle : msg\r\n\t};\r\n\t\r\n\tvar dialog = Ti.UI.createOptionDialog(opts);\r\n\t\r\n\tvar f = function(e) {\r\n\t\tconsole.log(\"!! UI.Confirm -> Click for: \"+msg+\" callback -> \"+(callback ? \"yes\" : \"no\"));\r\n\t\tdialog.removeEventListener(\"click\", f);\r\n\t\tif (callback) {callback(e);}\r\n\t};\r\n\tdialog.addEventListener('click', f);\r\n\tdialog.show();\r\n};\r\n\r\n// -- Calling the confirmation function -----------------\r\nUI.confirm(\"actions\", function(e) {\r\n console.log(e.source.options[e.index] + \" clicked);\r\n}, 0, ['click A','click B','click C']);\r\n{code}\r\n", "updateAuthor": { "name": "dbenhenni", "key": "dbenhenni", "displayName": "dbenhenni", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-06T08:58:56.000+0000", "updated": "2018-02-06T10:28:19.000+0000" }, { "id": "434076", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Reopening ticket. [~dbenhenni] Please format your code. Also, I am wondering how the above code even compiles, as \r\n{code:js}\r\n console.log(\"!! UI.Confirm -> Click for: \"msg\" callback -> \"+(callback ? \"yes\" : \"no\"));\r\n{code}\r\nincludes a syntax error around \"msg\" that represents a variable without {{\" + msg + \"}}.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-06T09:12:53.000+0000", "updated": "2018-02-06T09:23:45.000+0000" }, { "id": "434077", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I guess fix similar to Ti.UI.AlertDialog will fix the problem of Ti.UI.OptionDialogue also.\r\n[~reymundolopez] [~appsol] Can you guys please confirm if this issue is happening in Ti.UI.OptionDialog or Ti.UI.AlertDialog to you? And please share your test cases. Thanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-06T09:22:56.000+0000", "updated": "2018-02-06T09:23:39.000+0000" }, { "id": "434078", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "The following pull request fixes the Ti.UI.OptionDialog to have the same behavior as the Ti.UI.AlertDialog. It has been tested with a few hundred tries and working fine. \r\n\r\nPR (master): https://github.com/appcelerator/titanium_mobile/pull/9803\r\nPR (7_1_X): https://github.com/appcelerator/titanium_mobile/pull/9992\r\n\r\nTest-Case 1/2 (ran 100 times)\r\n{code:js}\r\nvar count = 0;\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Trigger'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n var dialog = Ti.UI.createAlertDialog({\r\n title: 'Test',\r\n message: 'Hello',\r\n buttonNames: ['OK', 'Cancel'],\r\n cancel: 1\r\n });\r\n dialog.addEventListener('click', function() {\r\n Ti.API.warn((++count) + ' CLICKED!');\r\n });\r\n dialog.show();\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n{code}\r\n\r\nTest-Case 2/2 (alert from background thread):\r\n{code:js}\r\n/**\r\n * This file is used to validate iOS test-cases. It is ran using the Xcode\r\n * project in titanium_mobile/iphone/iphone/Titanium.xcodeproj.\r\n *\r\n * Change the below code to fit your use-case. By default, it included a button\r\n * to trigger a log that is displayed in the Xcode console.\r\n */\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Trigger',\r\n width: 300,\r\n height: 45,\r\n top: 100,\r\n color: '#fff',\r\n backgroundColor: '#9B1C1F',\r\n borderRadius: 10\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n btn.setTitle('Loading ...');\r\n btn.setEnabled(false);\r\n\r\n var url = 'http://www.appcelerator.com';\r\n var client = Ti.Network.createHTTPClient({\r\n onload: function(e) {\r\n btn.setTitle('Trigger');\r\n btn.setEnabled(true);\r\n\r\n Ti.UI.createAlertDialog({\r\n message: 'Success',\r\n buttonNames: ['OK']\r\n }).show();\r\n },\r\n onerror: function(e) {\r\n btn.setTitle('Trigger');\r\n btn.setEnabled(true);\r\n\r\n Ti.UI.createAlertDialog({\r\n message: 'Error',\r\n buttonNames: ['OK']\r\n }).show();\r\n },\r\n timeout: 5000 // in milliseconds\r\n });\r\n client.open('GET', url);\r\n\r\n client.send();\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-06T09:52:42.000+0000", "updated": "2018-04-10T15:01:39.000+0000" }, { "id": "434102", "author": { "name": "reymundolopez", "key": "reymundolopez", "displayName": "Reymundo López", "active": true, "timeZone": "America/Mexico_City" }, "body": "[~vijaysingh] [~hknoechel] I'm having the problem with an {{Ti.UI.AlertDialog}} on Ti SDK 7.0.1, I'll put a small code to reproduce it for you guys.", "updateAuthor": { "name": "reymundolopez", "key": "reymundolopez", "displayName": "Reymundo López", "active": true, "timeZone": "America/Mexico_City" }, "created": "2018-02-06T16:14:07.000+0000", "updated": "2018-02-06T16:14:07.000+0000" }, { "id": "434569", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Moving out to 7.2.0 due to missing reproducible test-cases. We are trying to prevent providing fixes for issues that cannot be reproduced.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-16T14:31:55.000+0000", "updated": "2018-02-16T14:31:55.000+0000" }, { "id": "434992", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~reymundolopez]Ping for test case. Thanks!", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-28T10:07:18.000+0000", "updated": "2018-02-28T10:07:18.000+0000" }, { "id": "435494", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~reymundolopez] Another ping. We'd consider this for the earliest next release, but need feedback on the patch and your test-case if it does not work with the patch.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-03-12T16:56:08.000+0000", "updated": "2018-03-12T16:56:08.000+0000" }, { "id": "435497", "author": { "name": "reymundolopez", "key": "reymundolopez", "displayName": "Reymundo López", "active": true, "timeZone": "America/Mexico_City" }, "body": "[~hknoechel] and [~vijaysingh] sorry for not getting the test case, we decided to solve it by using a custom control, I tried every suggestion posted in this ticket and nothing seems to improve it.\r\n\r\nAlso, I was unable to have a simple code where I can reproduce it, it's only happening in one of our main apps (so far), also I added some logs to the SDK, and seems like the click event of the control is fired, but the function added to the listener is never fired, kinda weird.", "updateAuthor": { "name": "reymundolopez", "key": "reymundolopez", "displayName": "Reymundo López", "active": true, "timeZone": "America/Mexico_City" }, "created": "2018-03-12T17:01:57.000+0000", "updated": "2018-03-12T17:01:57.000+0000" }, { "id": "435510", "author": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "body": "We're seeing the same thing. Problem must have started when we moved our ios app to the main thread (we had to do that to interoperate with a critical third party library).\r\n\r\nUnfortunately for us, it's affecting our normally very polite \"rate our app\" prompt. Not only can the user not rate our app, but they can't permanently dismiss the prompt. It will hit them every time they run the app. :-(\r\n\r\nWe are also unable to reproduce in a simple app.js. And we don't have time to tear the entire app apart -- even with a binary search, it would take days to isolate the cause. We will probably write a simple AlertDialog replacement in JS.", "updateAuthor": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "created": "2018-03-12T19:32:47.000+0000", "updated": "2018-03-12T19:32:47.000+0000" }, { "id": "435511", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "I have been watching this thread with interest for a while. I have the same issues on both the AlertDialog and OptionDialog. But I have never been able to produce a reliable test case either. It just happens randomly - the alert popup appears, you choose an option ... and nothing happens. So you repeat the process a second time and it fires perfectly. \"Most\" times it fires correctly the first time.\r\n\r\nSimilar to @Reymundo I have also been considering creating a custom control to just move past this issue, but I was holding off, hoping that this ticket would be solved.\r\n\r\nI don't have any other information to add that hasn't already been shared in the above comments.", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2018-03-12T20:03:32.000+0000", "updated": "2018-03-12T20:03:32.000+0000" }, { "id": "435512", "author": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "body": "This seems to be a pretty good start on a JS module:\r\n\r\nhttp://www.kiteplans.info/2014/11/01/titanium-allouy-ios-android-module-custom-alert-module-to-replace-titanium-ui-alertdialog/", "updateAuthor": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "created": "2018-03-12T20:09:32.000+0000", "updated": "2018-03-12T20:09:32.000+0000" }, { "id": "435533", "author": { "name": "dbenhenni", "key": "dbenhenni", "displayName": "dbenhenni", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The thing Jason Priebe said sounds interesting. I also had to turn on the \"run-on-main-thread\" property after an earlier update, because a critical third party library didn't work any more.", "updateAuthor": { "name": "dbenhenni", "key": "dbenhenni", "displayName": "dbenhenni", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-03-13T08:22:07.000+0000", "updated": "2018-03-13T08:22:07.000+0000" }, { "id": "436611", "author": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "body": "Why is the fix for this bug getting pushed back again and again? This seems like a critical bug. It is inconsistent, so a developer might not notice that one of his dialogs isn't working deep inside the application. Also, it's a main thread issue, and main thread is increasingly more important, with Hyperloop and looking forward to TiSDK 8, which I believe will be main-thread-only.", "updateAuthor": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "created": "2018-04-08T20:36:52.000+0000", "updated": "2018-04-08T20:36:52.000+0000" }, { "id": "436618", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~jpriebe] It is not pushed back, it is in pending review. The sprint is just adjusted. You can try the patch by replacing the files from [the pull request|https://github.com/appcelerator/titanium_mobile/pull/9803/files] with the ones in your local SDK. Make a backup before and replace them in\r\n{code}\r\n~/Library/Application Support/Titanium/mobilesdk/osx/7.1.0.GA/iphone/Classes/\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-04-09T06:50:12.000+0000", "updated": "2018-04-09T07:11:22.000+0000" }, { "id": "436632", "author": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "body": "Thanks, Hans. I misunderstood all the JIRA messages I was seeing. Good to see you guys gave this priority. I'll try not to get too concerned about sprint reassignments in the future! :P\r\n", "updateAuthor": { "name": "jpriebe", "key": "jpriebe", "displayName": "Jason Priebe", "active": true, "timeZone": "America/New_York" }, "created": "2018-04-09T13:11:12.000+0000", "updated": "2018-04-09T13:11:12.000+0000" }, { "id": "436708", "author": { "name": "kosso", "key": "kosso", "displayName": "kosso", "active": true, "timeZone": "Europe/London" }, "body": "Thanks for that @Hans. Replacing those files in my SDK seems to have fixed this issue for me. :+1: ", "updateAuthor": { "name": "kosso", "key": "kosso", "displayName": "kosso", "active": true, "timeZone": "Europe/London" }, "created": "2018-04-10T12:55:16.000+0000", "updated": "2018-04-10T12:55:16.000+0000" }, { "id": "436839", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "And for me. So much better. Finally. Thank you.", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2018-04-12T17:11:12.000+0000", "updated": "2018-04-12T17:11:12.000+0000" }, { "id": "436840", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Yey! Thanks guys. 7.1.1 is expected for the next few weeks, so the manual patch can soon be replaced.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-04-12T17:28:09.000+0000", "updated": "2018-04-12T17:28:09.000+0000" }, { "id": "437256", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified changes are present in SDK builds 7.1.1.v20180419111054 & 7.2.0.v20180501064243", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-05-01T16:29:43.000+0000", "updated": "2018-05-01T16:29:43.000+0000" }, { "id": "438508", "author": { "name": "max87", "key": "max87", "displayName": "Marian Kucharcik", "active": true, "timeZone": "Europe/Prague" }, "body": "Hi guys, this problem persists on 7.2.0GA and 7.3.0build20180525122818\r\nTested on iPhone X, three clicks(clicked on cancel(1) and logs 1,0,0)\r\nTest code:\r\n\r\n{code:java}\r\nvar alertDialog = Ti.UI.createAlertDialog({\r\n\ttitle:\"Please click on cancel\",\r\n\tmessage:\"First time logs 1, second time logs 0\",\r\n\tbuttonNames:[\"Button\", \"Cancel\"],\r\n\t\r\n});\r\nversionAlertDialog.addEventListener(\"click\", function(e)\r\n{\r\n\tTi.API.log(e.index); \r\n}); \r\n{code}\r\n", "updateAuthor": { "name": "max87", "key": "max87", "displayName": "Marian Kucharcik", "active": true, "timeZone": "Europe/Prague" }, "created": "2018-06-19T12:50:12.000+0000", "updated": "2018-06-19T12:50:12.000+0000" }, { "id": "438515", "author": { "name": "max87", "key": "max87", "displayName": "Marian Kucharcik", "active": true, "timeZone": "Europe/Prague" }, "body": "Hi guys, I tried to set run-on-main-thread to false and alertDialog is acting normally.\r\nAs is stated above, It's not a good and it can cause another problems, so please look at it again.\r\nThanks", "updateAuthor": { "name": "max87", "key": "max87", "displayName": "Marian Kucharcik", "active": true, "timeZone": "Europe/Prague" }, "created": "2018-06-19T13:55:56.000+0000", "updated": "2018-06-19T13:55:56.000+0000" } ], "maxResults": 54, "total": 54, "startAt": 0 } } }