{ "id": "90801", "key": "TIMOB-8872", "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": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13401", "description": "Sprint 2012-09 Core", "name": "Sprint 2012-09 Core", "archived": true, "released": true, "releaseDate": "2012-05-06" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-04-25T13:20:23.000+0000", "created": "2012-04-24T10:29:36.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "core", "regression" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [], "assignee": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "updated": "2012-06-21T11:46:42.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Steps to reproduce:\r\n\r\n1. Checkout the lastest master build\r\n2. Run KS\r\n\r\nExpected:\r\nKS should run without any errors.\r\n\r\nActual:\r\nA runtime error occurs as soon as we launch KS:\r\n\r\n\r\nE/TiJSError(28389): (main) [769,1671] ----- Titanium Javascript Runtime Error -----\r\nE/TiJSError(28389): (main) [0,1671] - In app.js:189,29\r\nE/TiJSError(28389): (main) [0,1671] - Message: Uncaught TypeError: Cannot read property 'title' of undefined\r\nE/TiJSError(28389): (main) [0,1671] - Source: \t\tTi.API.info('tab ' + e.tab.title + ' prevTab = ' + (e.previousTab ? e.previ\r\n", "attachment": [], "flagged": false, "summary": "Android: Type error during KS launch", "creator": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "192421", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "The issue here is not so much a regression in platform behavior as correct behavior exposing previously masked issue with the logic in KS perhaps. Further discussion required to determine the correct way to deal with situation.", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2012-04-24T12:55:36.000+0000", "updated": "2012-04-24T12:55:36.000+0000" }, { "id": "192519", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "PR #2069 opened. In order to test the change, temporarily replace the app.js in Kitchen Sink with the one below. When running KS:\r\n1) Select tab 3 and you should see log output of the focus listener attached to the tabgroup and the window for tab 3\r\n2) Select tab 2 and you should see log output of the blur listener attached to the tabgroup and the window for tab 3\r\n\r\n{code}\r\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\n// create tab group\r\nvar tabGroup = Titanium.UI.createTabGroup({id:'tabGroup1'});\r\n\r\n\r\n//\r\n// create base UI tab and root window\r\n//\r\nvar win1 = Titanium.UI.createWindow({className:'win1'});\r\n\r\nvar tab1 = Titanium.UI.createTab({\r\n\tid:'tab1',\r\n\twindow:win1\r\n});\r\n\r\n//\r\n// create controls tab and root window\r\n//\r\nvar win2 = Titanium.UI.createWindow({\r\n\turl:'main_windows/controls.js',\r\n\ttitleid:'controls_win_title'\r\n});\r\nvar tab2 = Titanium.UI.createTab({\r\n\ticon:'images/tabs/KS_nav_ui.png',\r\n\ttitleid:'controls_win_title',\r\n\twindow:win2\r\n});\r\n\r\n\r\n//\r\n// create phone tab and root window\r\n//\r\nvar win3 = Titanium.UI.createWindow({\r\n\turl:'main_windows/phone.js',\r\n\ttitleid:'phone_win_title'\r\n});\r\nwin3.addEventListener('focus', function(e) {\r\n\tTi.API.info(\"FOCUS EVENT FIRED ON WINDOW: \" + e.tab); // e.tab should be undefined\r\n});\r\nwin3.addEventListener('blur', function(e) {\r\n\tTi.API.info(\"BLUR EVENT FIRED ON WINDOW: \" + e.index); // e.index should be undefined\r\n});\r\nvar tab3 = Titanium.UI.createTab({\r\n\ticon:'images/tabs/KS_nav_phone.png',\r\n\ttitleid:'phone_win_title',\r\n\twindow:win3\r\n});\r\n\r\n\r\n//\r\n// create platform tab and root window\r\n//\r\nvar win4 = Titanium.UI.createWindow({\r\n\turl:'main_windows/platform.js',\r\n\ttitleid:'platform_win_title'\r\n});\r\nvar tab4 = Titanium.UI.createTab({\r\n\ticon:'images/tabs/KS_nav_platform.png',\r\n\ttitleid:'platform_win_title',\r\n//\tCommented out as per 1773\r\n//\tactive:true,\r\n\twindow:win4\r\n});\r\n\r\n//\r\n// create mashup tab and root window\r\n//\r\nvar win5 = Titanium.UI.createWindow({\r\n\turl:'main_windows/mashups.js',\r\n\ttitleid:'mashups_win_title'\r\n});\r\nvar tab5 = Titanium.UI.createTab({\r\n\ticon:'images/tabs/KS_nav_mashup.png',\r\n\ttitleid:'mashups_win_title',\r\n\twindow:win5\r\n});\r\n\r\n//\r\n// add tabs\r\n//\r\ntabGroup.addTab(tab1);\r\ntabGroup.addTab(tab2);\r\ntabGroup.addTab(tab3);\r\ntabGroup.addTab(tab4);\r\ntabGroup.addTab(tab5);\r\n\r\ntabGroup.addEventListener('open',function()\r\n{\r\n\t// set background color back to white after tab group transition\r\n\tTitanium.UI.setBackgroundColor('#fff');\r\n});\r\n\r\ntabGroup.setActiveTab(1);\r\n// open tab group with a transition animation\r\ntabGroup.open({\r\n\ttransition: Titanium.UI.iPhone && Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT\r\n});\r\n\r\n// setTimeout(function()\r\n// {\r\n\t// tabGroup.close({\r\n\t\t// transition:Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT\r\n\t// });\r\n// },2000);\r\n\r\n\r\n//\r\n// TAB GROUP EVENTS\r\n//\r\nvar messageWin = Titanium.UI.createWindow({\r\n\theight:30,\r\n\twidth:250,\r\n\tbottom:70,\r\n\tborderRadius:10,\r\n\ttouchEnabled:false,\r\n\r\n\torientationModes : [\r\n\tTitanium.UI.PORTRAIT,\r\n\tTitanium.UI.UPSIDE_PORTRAIT,\r\n\tTitanium.UI.LANDSCAPE_LEFT,\r\n\tTitanium.UI.LANDSCAPE_RIGHT\r\n\t]\r\n});\r\nvar messageView = Titanium.UI.createView({\r\n\tid:'messageview',\r\n\theight:30,\r\n\twidth:250,\r\n\tborderRadius:10,\r\n\tbackgroundColor:'#000',\r\n\topacity:0.7,\r\n\ttouchEnabled:false\r\n});\r\n\r\nvar messageLabel = Titanium.UI.createLabel({\r\n\tid:'messagelabel',\r\n\ttext:'',\r\n\tcolor:'#fff',\r\n\twidth:250,\r\n\theight:'auto',\r\n\tfont:{\r\n\t\tfontFamily:'Helvetica Neue',\r\n\t\tfontSize:13\r\n\t},\r\n\ttextAlign:'center'\r\n});\r\nmessageWin.add(messageView);\r\nmessageWin.add(messageLabel);\r\n\r\n//\r\n// TAB EVENTS\r\n//\r\n\r\n// tab group close event\r\ntabGroup.addEventListener('close', function(e)\r\n{\r\n\tmessageLabel.text = 'tab group close event';\r\n\tmessageWin.open();\r\n\tif (Ti.Platform.osname == \"iphone\") {\r\n//On iOS, when we're closing the tab group, this is a result\r\n//of the tab group example of 'Close/Animate Tab Group' and\r\n//we want to reopen the tab group so the user can continue with\r\n//using Kitchen Sink. HOWEVER, on Android, this is also triggered\r\n//when the app is being closed via back button, where reopening\r\n//the tab group is not desired. This is purely a quirk of the tests.\r\n\t\ttabGroup.open();\r\n\t}\r\n\tsetTimeout(function()\r\n\t{\r\n\t\tmessageWin.close({opacity:0,duration:500});\r\n\t},1000);\r\n});\r\n\r\n\r\n// tab group open event\r\ntabGroup.addEventListener('open', function(e)\r\n{\r\n\tmessageLabel.text = 'tab group open event';\r\n\tmessageWin.open();\r\n\tsetTimeout(function()\r\n\t{\r\n\t\tmessageWin.close({opacity:0,duration:500});\r\n\t},1000);\r\n\r\n});\r\n\r\n// focus event listener for tracking tab changes\r\ntabGroup.addEventListener('focus', function(e)\r\n{\r\n\tmessageLabel.text = 'tab changed to ' + e.index + ' old index ' + e.previousIndex;\r\n\tmessageWin.open();\r\n\tsetTimeout(function()\r\n\t{\r\n\t\tTi.API.info('tab ' + e.tab.title + ' prevTab = ' + (e.previousTab ? e.previousTab.title : null));\r\n\t\tmessageLabel.text = 'active title ' + e.tab.title + ' old title ' + (e.previousTab ? e.previousTab.title : null);\r\n\t},1000);\r\n\r\n\tsetTimeout(function()\r\n\t{\r\n\t\tmessageWin.close({opacity:0,duration:500});\r\n\t},2000);\r\n\r\n});\r\n\r\n// blur event listener for tracking tab changes\r\ntabGroup.addEventListener('blur', function(e)\r\n{\r\n\tTitanium.API.info('tab blur - new index ' + e.index + ' old index ' + e.previousIndex);\r\n});\r\n\r\n\r\n//\r\n// CUSTOM EVENTS\r\n//\r\nTitanium.App.addEventListener('event_one', function(e)\r\n{\r\n\tmessageLabel.text = 'app.js: event one, array length = ' + e.data.length;\r\n\tmessageWin.open();\r\n\tsetTimeout(function()\r\n\t{\r\n\t\tmessageWin.close({opacity:0,duration:500});\r\n\t},1000);\r\n});\r\n\r\nTitanium.App.addEventListener('event_two', function(e)\r\n{\r\n\tmessageLabel.text = 'app.js: event two, name = ' + e.name;\r\n\tmessageWin.open();\r\n\tsetTimeout(function()\r\n\t{\r\n\t\tmessageWin.close({opacity:0,duration:500});\r\n\t},1000);\r\n\r\n});\r\n\r\n//\r\n// CREATE CUSTOM LOADING INDICATOR\r\n//\r\nvar indWin = null;\r\nvar actInd = null;\r\nfunction showIndicator()\r\n{\r\n\tif (Ti.Platform.osname != 'android')\r\n\t{\r\n\t\t// window container\r\n\t\tindWin = Titanium.UI.createWindow({\r\n\t\t\theight:150,\r\n\t\t\twidth:150\r\n\t\t});\r\n\r\n\t\t// black view\r\n\t\tvar indView = Titanium.UI.createView({\r\n\t\t\theight:150,\r\n\t\t\twidth:150,\r\n\t\t\tbackgroundColor:'#000',\r\n\t\t\tborderRadius:10,\r\n\t\t\topacity:0.8\r\n\t\t});\r\n\t\tindWin.add(indView);\r\n\t}\r\n\r\n\t// loading indicator\r\n\tactInd = Titanium.UI.createActivityIndicator({\r\n\t\tstyle:Titanium.UI.iPhone && Titanium.UI.iPhone.ActivityIndicatorStyle.BIG,\r\n\t\theight:30,\r\n\t\twidth:30\r\n\t});\r\n\r\n\tif (Ti.Platform.osname != 'android')\r\n\t{\r\n\t\tindWin.add(actInd);\r\n\r\n\t\t// message\r\n\t\tvar message = Titanium.UI.createLabel({\r\n\t\t\ttext:'Loading',\r\n\t\t\tcolor:'#fff',\r\n\t\t\twidth:'auto',\r\n\t\t\theight:'auto',\r\n\t\t\tfont:{fontSize:20,fontWeight:'bold'},\r\n\t\t\tbottom:20\r\n\t\t});\r\n\t\tindWin.add(message);\r\n\t\tindWin.open();\r\n\t} else {\r\n\t\tactInd.message = \"Loading\";\r\n\t}\r\n\tactInd.show();\r\n\r\n}\r\n\r\nfunction hideIndicator()\r\n{\r\n\tactInd.hide();\r\n\tif (Ti.Platform.osname != 'android') {\r\n\t\tindWin.close({opacity:0,duration:500});\r\n\t}\r\n}\r\n\r\n//\r\n// Add global event handlers to hide/show custom indicator\r\n//\r\nTitanium.App.addEventListener('show_indicator', function(e)\r\n{\r\n\tTi.API.info(\"IN SHOW INDICATOR\");\r\n\tshowIndicator();\r\n});\r\nTitanium.App.addEventListener('hide_indicator', function(e)\r\n{\r\n\tTi.API.info(\"IN HIDE INDICATOR\");\r\n\thideIndicator();\r\n});\r\n\r\n// trap app shutdown event\r\nTitanium.App.addEventListener('close',function(e)\r\n{\r\n\tTi.API.info(\"The application is being shutdown\");\r\n});\r\n\r\n// test for loading in a root-level include\r\nTi.include(\"welcome.js\");\r\n\r\n// test out logging to developer console, formatting and localization\r\nTi.API.info(String.format(\"%s%s\",L(\"welcome_message\",\"default_not_set\"),Titanium.version));\r\nTi.API.debug(String.format(\"%s %s\",L(\"user_agent_message\",\"default_not_set\"),Titanium.userAgent));\r\n\r\nTi.API.debug(String.format(\"locale specific date is %s\",String.formatDate(new Date()))); // default is short\r\nTi.API.debug(String.format(\"locale specific date (medium) is %s\",String.formatDate(new Date(),\"medium\")));\r\nTi.API.debug(String.format(\"locale specific date (long) is %s\",String.formatDate(new Date(),\"long\")));\r\nTi.API.debug(String.format(\"locale specific time is %s\",String.formatTime(new Date())));\r\nTi.API.debug(String.format(\"locale specific currency is %s\",String.formatCurrency(12.99)));\r\nTi.API.debug(String.format(\"locale specific decimal is %s\",String.formatDecimal(12.99)));\r\n\r\n\r\nTi.API.info(\"should be en, was = \"+Ti.Locale.currentLanguage);\r\nTi.API.info(\"welcome_message = \"+Ti.Locale.getString(\"welcome_message\"));\r\nTi.API.info(\"should be def, was = \"+Ti.Locale.getString(\"welcome_message2\",\"def\"));\r\nTi.API.info(\"welcome_message = \"+L(\"welcome_message\"));\r\nTi.API.info(\"should be def, was = \"+L(\"welcome_message2\",\"def\"));\r\nTi.API.info(\"should be 1, was = \"+String.format('%d',1));\r\nTi.API.info(\"should be 1.0, was = \"+String.format('%1.1f',1));\r\nTi.API.info(\"should be hello, was = \"+String.format('%s','hello'));\r\n\r\n// test to check that we can iterate over titanium based objects\r\n(function(){\r\n\tTi.API.info(\"you should see a list of properties (3 or more) below this line\");\r\n\tTi.API.info(\"---------------------------------------------------------------\");\r\n\tfor (var p in win1)\r\n\t{\r\n\t\tTi.API.info(\" win1 property: \"+p);\r\n\t}\r\n\tTi.API.info(\"Did you see properties? ^^^^^ \");\r\n\tTi.API.info(\"---------------------------------------------------------------\");\r\n\r\n\tTi.API.info(\"you should see a list of modules (3 or more) below this line\");\r\n\tTi.API.info(\"---------------------------------------------------------------\");\r\n\tfor (var p in Titanium)\r\n\t{\r\n\t\tTi.API.info(\" module: \"+p);\r\n\t}\r\n\tTi.API.info(\"Did you see modules? ^^^^^ \");\r\n\tTi.API.info(\"---------------------------------------------------------------\");\r\n})();\r\n\r\n\r\nTi.include(\"examples/version.js\");\r\n\r\nif (isiOS4Plus())\r\n{\r\n\t// register a background service. this JS will run when the app is backgrounded\r\n\tvar service = Ti.App.iOS.registerBackgroundService({url:'bg.js'});\r\n\r\n\tTi.API.info(\"registered background service = \"+service);\r\n\r\n\t// listen for a local notification event\r\n\tTi.App.iOS.addEventListener('notification',function(e)\r\n\t{\r\n\t\tTi.API.info(\"local notification received: \"+JSON.stringify(e));\r\n\t});\r\n\r\n\t// fired when an app resumes for suspension\r\n\tTi.App.addEventListener('resume',function(e){\r\n\t\tTi.API.info(\"app is resuming from the background\");\r\n\t});\r\n\tTi.App.addEventListener('resumed',function(e){\r\n\t\tTi.API.info(\"app has resumed from the background\");\r\n\t});\r\n\r\n\tTi.App.addEventListener('pause',function(e){\r\n\t\tTi.API.info(\"app was paused from the foreground\");\r\n\t});\r\n}\r\n\r\nif (Ti.App.Properties.getBool('showNotice', true)){\r\n\tvar alertNotice = Ti.UI.createAlertDialog({\r\n\t\tbuttonNames: ['OK', 'Visit docs', 'Don\\'t show again'],\r\n\t\tcancel:0,\r\n\t\ttitle: 'Notice',\r\n\t\tmessage: 'While this KitchenSink provides an extensive demonstration of the Titanium API, its structure is not recommended for production apps. Please refer to our documentation for more details.'\r\n\t});\r\n\talertNotice.show();\r\n\talertNotice.addEventListener('click', function(e){\r\n\t\tif(e.index === 1){\r\n\t\t\tTitanium.Platform.openURL('http://wiki.appcelerator.org/display/guides/Example+Applications');\r\n\t\t}\r\n\t\tif(e.index === 2){\r\n\t\t\tTi.App.Properties.setBool('showNotice', false);\r\n\t\t}\r\n\t});\r\n}\r\n{code}\r\n", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2012-04-24T19:30:00.000+0000", "updated": "2012-04-25T10:46:59.000+0000" }, { "id": "199605", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified no longer producing type error on launch. Also verified blur/focus events with sample code provided. Used SDK 2.1.0.v20120618154152.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-21T11:46:42.000+0000", "updated": "2012-06-21T11:46:42.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }