{ "id": "86840", "key": "TIMOB-7777", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2012-02-23T14:11:39.000+0000", "created": "2012-02-22T15:19:06.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-09T22:53:06.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": "h3.Issue\r\nPassing arguments likewise \"new Date().setFullYear(2009, 0, 0)\" lead the app to crash.\r\n\r\nh6.Steps to reproduce\r\nThrow code below to an app.js and run\r\n\r\nh6.Unexpected behavior\r\nApp crashes immediately once launched\r\n\r\nh6.Snippet code\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n});\r\n\r\nvar view = Titanium.UI.createView({\r\n height : 260,\r\n bottom : -260,\r\n zIndex : 50\r\n});\r\n\r\nTi.API.info( new Date().setFullYear(2009, 0, 0) );\r\n\r\nvar picker = Ti.UI.createPicker({\r\n type : Ti.UI.PICKER_TYPE_DATE,\r\n minDate : new Date().setFullYear(2009, 0, 0) ,\r\n maxDate : new Date(),\r\n top : 44,\r\n bottom : 0,\r\n selectionIndicator : true\r\n});\r\n\r\nview.add(picker);\r\n\r\nwin.add(view);\r\n\r\nwin.open();\r\n\r\n\r\n\r\n//Sliding in & out\r\nvar slideIn = Titanium.UI.createAnimation({\r\nbottom:50\r\n});\r\n\r\nvar slideOut = Titanium.UI.createAnimation({\r\nbottom:-250\r\n});\r\n\r\n\r\n\r\n//events to carry the slides\r\nwin.addEventListener('click', function() {\r\n view.animate(slideIn);\r\n});\r\n\r\n//if index change\r\npicker.addEventListener('change', function() {\r\n\tview.animate(slideOut); \r\n});\r\n{code}\r\n\r\nh6.Titanium SDK 1.8.0.1\r\n{code:title=ConsoleLog}\r\n[INFO] One moment, building ...\r\n[INFO] Titanium SDK version: 1.8.0.1 (12/22/11 13:09 fbdc96f)\r\n[INFO] iPhone Device family: universal\r\n[INFO] iPhone SDK version: 5.0\r\n[INFO] iPhone simulated device: iphone\r\n[INFO] Launching application in Simulator\r\n[INFO] Launched application in Simulator (2.40 seconds)\r\n[INFO] Found 5.0 patch installed\r\n[INFO] Application started\r\n[INFO] T15034/1.0 (1.8.0.1.fbdc96f)\r\n[INFO] 1230765016072\r\n[ERROR] Invalid type passed to function. expected: NSDate, was: __NSCFNumber in -[TiUIPicker setMinDate_:] (TiUIPicker.m:165)\r\n2012-02-22 17:10:16.087 T15034[60656:17603] -[__NSCFNumber isEqualToDate:]: unrecognized selector sent to instance 0x8c75670\r\n[ERROR] The application has crashed with an unhandled exception. Stack trace:\r\n0 CoreFoundation 0x02e67052 __exceptionPreprocess + 178\r\n1 libobjc.A.dylib 0x02c87d0a objc_exception_throw + 44\r\n2 CoreFoundation 0x02e68ced -[NSObject doesNotRecognizeSelector:] + 253\r\n3 CoreFoundation 0x02dcdf00 ___forwarding___ + 432\r\n4 CoreFoundation 0x02dcdce2 _CF_forwarding_prep_0 + 50\r\n5 UIKit 0x00be6eba -[UIDatePickerView setMinimumDate:] + 52\r\n6 UIKit 0x00be56d5 -[UIDatePicker setMinimumDate:] + 49\r\n7 T15034 0x00170c71 -[TiUIPicker setMinDate_:] + 897\r\n8 CoreFoundation 0x02e68e72 -[NSObject performSelector:withObject:] + 66\r\n9 T15034 0x000d16e1 DoProxyDelegateReadKeyFromProxy + 321\r\n10 T15034 0x000d19e3 DoProxyDelegateReadValuesWithKeysFromProxy + 627\r\n11 T15034 0x0008a241 -[TiUIView readProxyValuesWithKeys:] + 65\r\n12 T15034 0x000707d4 -[TiViewProxy firePropertyChanges] + 116\r\n13 T15034 0x0006e2d7 -[TiViewProxy view] + 1095\r\n14 T15034 0x0006e47d -[TiViewProxy view] + 1517\r\n15 T15034 0x0006e47d -[TiViewProxy view] + 1517\r\n16 T15034 0x00066143 -[TiWindowProxy openOnUIThread:] + 163\r\n17 CoreFoundation 0x02e68e72 -[NSObject performSelector:withObject:] + 66\r\n18 Foundation 0x006b09ef __NSThreadPerformPerform + 254\r\n19 CoreFoundation 0x02e3b97f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15\r\n20 CoreFoundation 0x02d9eb73 __CFRunLoopDoSources0 + 243\r\n21 CoreFoundation 0x02d9e454 __CFRunLoopRun + 1012\r\n22 CoreFoundation 0x02d9ddb4 CFRunLoopRunSpecific + 212\r\n23 CoreFoundation 0x02d9dccb CFRunLoopRunInMode + 123\r\n24 GraphicsServices 0x02ac6879 GSEventRunModal + 207\r\n25 GraphicsServices 0x02ac693e GSEventRun + 114\r\n26 UIKit 0x009e7a9b UIApplicationMain + 1175\r\n27 T15034 0x0000621a main + 442\r\n28 T15034 0x00002c35 start + 53\r\n2012-02-22 17:10:16.090 T15034[60656:17603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber isEqualToDate:]: unrecognized selector sent to instance 0x8c75670'\r\n*** First throw call stack:\r\n(0x2e67052 0x2c87d0a 0x2e68ced 0x2dcdf00 0x2dcdce2 0xbe6eba 0xbe56d5 0x170c71 0x2e68e72 0xd16e1 0xd19e3 0x8a241 0x707d4 0x6e2d7 0x6e47d 0x6e47d 0x66143 0x2e68e72 0x6b09ef 0x2e3b97f 0x2d9eb73 0x2d9e454 0x2d9ddb4 0x2d9dccb 0x2ac6879 0x2ac693e 0x9e7a9b 0x621a 0x2c35)\r\nterminate called throwing an exception\r\n[INFO] Application has exited from Simulator\r\n{code}\r\n\r\nh6.Titanium SDK 2.0\r\n{code:title=consoleLog}\r\n[INFO] One moment, building ...\r\n[INFO] Titanium SDK version: 2.0.0 (02/16/12 18:01 f0ea3e8)\r\n[INFO] iPhone Device family: universal\r\n[INFO] iPhone SDK version: 5.0\r\n[INFO] iPhone simulated device: iphone\r\n[INFO] Performing full rebuild. This will take a little bit. Hold tight...\r\n[INFO] Skipping JS compile, running from simulator\r\n[INFO] Launching application in Simulator\r\n[INFO] Launched application in Simulator (39.58 seconds)\r\n[INFO] Found 5.0 patch installed\r\n[INFO] Application started\r\n[INFO] T15034/1.0 (2.0.0.v20120216180135.f0ea3e8)\r\n[INFO] 1230765259916\r\n[ERROR] Invalid type passed to function. expected: NSDate, was: __NSCFNumber in -[TiUIPicker setMinDate_:] (TiUIPicker.m:166)\r\n[ERROR] Script Error = Invalid type passed to function. expected: NSDate, was: __NSCFNumber in -[TiUIPicker setMinDate_:] (TiUIPicker.m:166) at app.js (line 25).\r\n{code}\r\n\r\n\r\nh6.Definition and Usage\r\nThe setFullYear() method sets the year (four digits), according to local time.\r\nNote: This method is always used in conjunction with a Date object.\r\n\r\nh6.Further links\r\nhttps://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/setFullYear", "attachment": [], "flagged": false, "summary": "iOS: Setting property of picker like new Date().setFullYear(2009, 0, 0) lead app to crash", "creator": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "environment": " Product: Mobile\r\n Titanium SDK: Mobile 1.8.0.1, 2.0\r\n Platform OS: iOS\r\n Platform OS Version: 4.2", "comment": { "comments": [ { "id": "184038", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "This test case is not valid.\r\n\r\n\r\nFirst thing is day number:\r\n\r\ndayValue \r\n An integer between 1 and 31 representing the day of the month.\r\n\r\n\r\n\r\nIn test case it is defined as 0.\r\n\r\n\r\n\r\nAlso, \"setFullYear\" does not return \"Date\" object, but \"Number\" object (that is, unix time) as can be seen in this example:\r\n\r\n\r\n{code}\r\nvar d = new Date();\r\n\t\r\nvar r = d.setFullYear(2009, 0, 1);\r\n\r\nTi.API.info(Object.prototype.toString.call(d));\r\nTi.API.info(Object.prototype.toString.call(r));\r\n{code}\r\n\r\n\r\nThe output is:\r\n\r\n[object Date]\r\n[object Number]\r\n\r\n\r\nSo, to fix this example, date object needs to be passed to date picker and not a number.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-02-23T03:04:54.000+0000", "updated": "2012-02-23T03:04:54.000+0000" }, { "id": "184104", "author": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks, Ivan.", "updateAuthor": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-23T14:11:20.000+0000", "updated": "2012-02-23T14:11:20.000+0000" }, { "id": "410855", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-09T22:53:06.000+0000", "updated": "2017-03-09T22:53:06.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }