[TIMOB-2206] setInterval unreliable runs code 0, 1 or repeatadly.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2012-07-26T11:33:32.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Anders H. |
Assignee | Neeraj Gupta |
Created | 2011-04-15T03:13:30.000+0000 |
Updated | 2012-07-26T21:44:31.000+0000 |
Description
While trying to demonstrate another problem I created a new hello world project and run into this. (Android simulator, APIs 2.1-update1, HVGA. Titanium SDK 1.4.0, Titanium Developer (1.2.1) )
Press the launch-button in Titanium Developer, watch if Alert1
(Hej1), Alert2 (Hej2), Alert3(Hej3) and "Timer" is showing on the
display.
Re-press the launch-button, watch for the same thing.
Re-press the launch-button, watch for the same thing.
Re-press the launch-button, watch for the same thing.
Re-press the launch-button, watch for the same thing.
Re-press the launch-button, watch for the same thing.
Re-press the launch-button, watch for the same thing.
Re-press the launch-button, watch for the same thing.
Most of the time I get Alert3 and Alert2 to show. Sometimes also Timer (1 time). One out of ten times, the timer is actually working. I might see Alert1 briefly, then covered by the window.
Here is the code (look at bottom lines for changes to the
HelloWorld project).
----------- app.js --------------
// this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#000');
// create tab group var tabGroup = Titanium.UI.createTabGroup();
// // create base UI tab and root window // var win1 =
Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
}); var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win1.add(label1);
// // create controls tab and root window // var win2 =
Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff',
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win2.add(label2);
// // add tabs // tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
// open tab group tabGroup.open();
alert('Hej1');
alert('Hej2');
var A = setInterval(function(){alert('Timeout');},1000);
alert('Hej3');
---------------------log of when timer showed once!
------------------------- [TRACE] I/Log ( 1385): (main) [1,1]
checkpoint, app created. [TRACE] I/Log ( 1385): (main) [0,0]
checkpoint, on root activity create. [TRACE] D/TiApplication( 1385): (main)
[87,87] Analytics Event: type=ti.start [TRACE] D/TiApplication( 1385):
event=ti.start [TRACE] D/TiApplication( 1385):
timestamp=2010-10-27T20:19:23.032+0000 [TRACE] D/TiApplication( 1385):
mid=b47c75af-f1fe-49c9-989c-49d608652d73 [TRACE] D/TiApplication( 1385):
sid=43073f16-c401-4cf5-b844-2d4f13d345cb [TRACE] D/TiApplication( 1385):
aguid=b10cb0a2-30ab-4e2c-87da-eadd08ba8f39 [TRACE] D/TiApplication( 1385): isJSON=true
[TRACE] D/TiApplication( 1385):
payload={os [TRACE] D/dalvikvm( 1385): GC freed 3858
objects / 373664 bytes in 83ms [TRACE] E/ROOT ( 1385): (main) [441,528]
Leaving TiRootActivity.onCreate [TRACE] I/Log ( 1385): (main) [0,0]
checkpoint, on root activity resume. [TRACE] I/TiRootActivity( 1385): (Thread-9)
[18,18] eval app.js [TRACE] D/KrollContext( 1385):
(kroll$1) [6,24] eval file: app://app.js [TRACE] W/TiAnalyticsSvc( 1385):
(Thread-10) [60,84] Analytics Service Started [TRACE] I/ActivityManager( 53): Displayed
activity com.x.testofevetargs/.TestofevetargsActivity: 2243 ms
(total 2243 ms) [TRACE] I/TabGroupProxy( 1385): (main)
[580,664] handleOpen [TRACE] I/ActivityManager( 53):
Starting activity: Intent {
cmp=com.x.testofevetargs/ti.modules.titanium.ui.TiTabActivity (has
extras) } [TRACE] I/ALERT ( 1385): (kroll$1) [51,715]
Hej1 [TRACE] W/TiTabActivity( 1385): (main)
[72,787] Notifying TiTabGroup, activity is created [TRACE] I/ALERT ( 1385): (kroll$1)
[124,911] Hej2 [TRACE] I/ALERT ( 1385): (kroll$1)
[107,1018] Hej3 [TRACE] D/dalvikvm( 1385): GC freed 5138
objects / 305216 bytes in 134ms [TRACE] W/TiActivity( 1385): (main)
[528,1546] Notifying TiUIWindow, activity is created [TRACE] D/TitaniumModule( 1385): (Timer-0)
[472,2018] calling interval timer 0 @1288210765501 [TRACE] I/ALERT ( 1385): (kroll$1) [7,2025]
Timeout [TRACE] I/ActivityManager( 53): Displayed
activity com.x.testofevetargs/ti.modules.titanium.ui.TiTabActivity:
1415 ms (total 1415 ms) [TRACE] I/TiAnalyticsSvc( 1385):
(Thread-10) [1000,3025] Sending 1 analytics events. [TRACE] D/dalvikvm( 1385): GC freed 5580
objects / 378480 bytes in 91ms [TRACE] D/dalvikvm( 1385): GC freed 3589
objects / 190760 bytes in 86ms [TRACE] W/TiAnalyticsSvc( 1385):
(Thread-10) [3268,6293] Stopping Analytics Service
Cannot reproduce in SDK 2.2.0.014b86f with iPhone Sim 5.1.