{ "id": "172448", "key": "AC-5979", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2018-12-02T09:50:41.000+0000", "created": "2018-10-17T06:32:52.000+0000", "labels": [ "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2018-12-02T09:50:41.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "When using `TabGroup.activeTab.openWindow` the windows that opens sometimes does not appear. The sample code below generally replicates the problem the first time the function is called, without the (code heavy) window, instead a black screen appears.\r\n\r\n{code:javascript}\r\n'use strict';\r\nfunction createWindow() {\r\n var win = Ti.UI.createWindow();\r\n\r\n function getRandomColor() {\r\n var letters = '0123456789ABCDEF';\r\n var color = '#';\r\n for (var i = 0; i < 6; i++) {\r\n color += letters[Math.floor(Math.random() * 16)];\r\n }\r\n return color;\r\n }\r\n function rand() {\r\n return Math.floor(Math.random() * 10);\r\n }\r\n function createRow(i) {\r\n var r = Ti.UI.createTableViewRow({\r\n backgroundColor: getRandomColor(),\r\n height: 50\r\n });\r\n var l = Ti.UI.createLabel({\r\n text: 'Loading...' + i,\r\n left: 0\r\n });\r\n r.add(l);\r\n r.go = function() {\r\n setTimeout(function() {\r\n l.text = 'Loaded ' + i;\r\n //r.backgroundColor = getRandomColor();\r\n l.animate({\r\n duration: 500,\r\n autoreverse: true,\r\n repeat: 5,\r\n left: 250\r\n });\r\n }, rand() * 200);\r\n };\r\n return r;\r\n }\r\n var rows = [];\r\n for (var i = 0; i < 10000; i++) {\r\n rows.push(createRow(i));\r\n }\r\n\r\n function createSection() {\r\n var s = Ti.UI.createTableViewSection();\r\n rows.forEach(r => {\r\n s.add(r);\r\n setTimeout(function() {\r\n r.go();\r\n }, 0);\r\n });\r\n return s;\r\n }\r\n\r\n var table = Ti.UI.createTableView({\r\n data: [createSection()]\r\n });\r\n\r\n win.add(table);\r\n return win;\r\n}\r\n\r\nfunction createTabGroup() {\r\n var tabs = ['blue', 'red', 'green', 'yellow'].map(function(c) {\r\n var win = Ti.UI.createWindow({\r\n backgroundColor: c,\r\n title: c\r\n });\r\n win.add(Ti.UI.createLabel({ text: 'I am a' + c + ' window.' }));\r\n win.addEventListener('click', openTab);\r\n\r\n var tab = Ti.UI.createTab({\r\n window: win,\r\n title: c\r\n });\r\n return tab;\r\n });\r\n var tabGroup = Ti.UI.createTabGroup({\r\n tabs: tabs\r\n });\r\n return tabGroup;\r\n}\r\nvar tabGroup = createTabGroup();\r\n\r\nlet win;\r\nfunction openTab() {\r\n //if (win) { tabGroup.activeTab.close(win); }\r\n win = createWindow();\r\n tabGroup.activeTab.open(win);\r\n}\r\nsetInterval(openTab, 3000);\r\n\r\ntabGroup.open();\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "iOS 12 - TabGroup.activeTab.openWindow opens window blank", "creator": { "name": "dbankier", "key": "dbankier", "displayName": "David Bankier", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dbankier", "key": "dbankier", "displayName": "David Bankier", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "442680", "author": { "name": "dbankier", "key": "dbankier", "displayName": "David Bankier", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This can be replicated in the simulator and with or without jscore.", "updateAuthor": { "name": "dbankier", "key": "dbankier", "displayName": "David Bankier", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-17T06:36:49.000+0000", "updated": "2018-10-17T06:36:49.000+0000" }, { "id": "442682", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "So i guess this is just an example to replicate the problem, right? Anyhow, the excessive use of {{setTimeout(func, 0)}} seems to be an issue. What happens under the hood is that a new thread will be created so the timer does not block on the main thread until it is triggered. You call {{setTimeout}} 10000 times every three seconds in this example. All these calls pile up until eventually it crashes somewhere in the internal thread handling of the kernel because the device cannot process all these threads fast enough. I had ~1500 threads active at the time of the crashes which is just way too much for the OS to handle.\r\n\r\nRemoving the {{setTimeout}} removed the main issue for me and more windows opened after some time. However, i guess you were doing this to properly schedule the {{animate}} calls after adding a new row?\r\n", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-10-17T08:56:06.000+0000", "updated": "2018-10-17T08:56:06.000+0000" }, { "id": "442687", "author": { "name": "dbankier", "key": "dbankier", "displayName": "David Bankier", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is just example code.\r\n\r\nThe issue happens even without the interval/timeout. I am using it to save clicks and taps as it is hard to replicate.\r\nI have large apps where tapping on a menu item opens a window in this manner (without a timeout) and sometimes appears blank.", "updateAuthor": { "name": "dbankier", "key": "dbankier", "displayName": "David Bankier", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-17T10:20:08.000+0000", "updated": "2018-10-17T10:20:08.000+0000" }, { "id": "442689", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "Can you provide a sample project? With the example code the app is crashing due to the massive amount of threads. On sim it's going black for a short time but then it also crashes. Are you seeing crashes too? Do you have crash reports you can share? Or will it just open a black window but keeps running?", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-10-17T11:30:03.000+0000", "updated": "2018-10-17T11:30:03.000+0000" }, { "id": "443729", "author": { "name": "kstorm001", "key": "kstorm001", "displayName": "Keith Storm", "active": true, "timeZone": "America/New_York" }, "body": "I am experiencing this same issue on my apps as well. Not using any setTimeout code. Just randomly get a blank window instead of my window with tableview. The app does not crash for me, just blank window. It appears to happen more frequently on older devices. It is pretty common with iPhone 6 devices.", "updateAuthor": { "name": "kstorm001", "key": "kstorm001", "displayName": "Keith Storm", "active": true, "timeZone": "America/New_York" }, "created": "2018-11-19T01:26:00.000+0000", "updated": "2018-11-19T02:48:20.000+0000" }, { "id": "443793", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~kstorm001], Can you provide a standalone sample code that generates the issue for the older iOS device? We will lest on our end. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-11-20T21:39:12.000+0000", "updated": "2018-11-20T21:39:12.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }