{ "id": "93561", "key": "TIMOB-9663", "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": "13503", "description": "Sprint 2012-14 Core", "name": "Sprint 2012-14 API", "archived": true, "released": true, "releaseDate": "2012-07-13" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-12-21T05:35:17.000+0000", "created": "2012-06-20T14:07:05.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "module_api", "qe-automatedtest" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [ { "id": "17909", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "91153", "key": "MOD-682", "fields": { "summary": "Cloud: Key-Values - On iOS, if you increment a string value, then a \"Invalid OAuth signature\" alert appears", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2015-01-16T00:04:27.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": "An issue has been identified during the investigation of MOD-682 having to do with how 'NaN' is converted to a string only on iOS. I have narrowed down the issue to the 'NaN' value being converted to lowercase 'nan' in certain situations. This causes an issue when the OAuth signature, for example, has been calculated based on a string value of 'NaN' but the value sent in the HTTP request is converted internally to a string value of 'nan' (ie. signature mismatch occurs). The serialization of the dictionary argument that is passed to the HTTPClient.send method is where the value is getting converted to 'nan' instead of 'NaN'.\r\n\r\nThis works correctly on Android and MobileWeb, but not on iOS.\r\n\r\nI have reproduced this in the following sample application:\r\n{code}\r\nvar a1 = NaN;\r\nvar b1 = parseInt(\"X\", 10);\r\nTi.API.info(\"A1:\" + a1);\r\nTi.API.info(\"B1:\" + b1);\r\nTi.API.info(a1);\r\nTi.API.info(b1);\r\n\r\nvar y = {\r\n\ta2: NaN,\r\n\tb2: parseInt(\"X\", 10)\r\n};\r\nTi.API.info(\"A2:\" + y.a2);\r\nTi.API.info(\"B2:\" + y.b2);\r\nTi.API.info(y.a2);\r\nTi.API.info(y.b2);\r\n{code}\r\n\r\n\r\nThe following output is generated on each of the platforms:\r\n\r\n|| iOS || Android || MobileWeb ||\r\n| A1: NaN | A1: NaN | A1: NaN |\r\n| B1: NaN | B1: NaN | B1: NaN |\r\n| {color:red}nan{color} | NaN | NaN |\r\n| {color:red}nan{color} | NaN | NaN |\r\n| A2: NaN | A2: NaN | A2: NaN |\r\n| B2: NaN | B2: NaN | B2: NaN |\r\n| {color:red}nan{color} | NaN | NaN |\r\n| {color:red}nan{color} | NaN | NaN |\r\n\r\nNotice that the value of 'nan' is generated when the value is being converted directly to a string and not being concatenated to another string.\r\n\r\n\r\nSome additional information regarding this issue on iOS. Given the following Objective-C code:\r\n\r\n{code}\r\n NSString* test;\r\n\r\n NSDecimalNumber *v1 = [NSDecimalNumber notANumber];\r\n NSString *className = NSStringFromClass([v1 class]); \r\n test = [v1 stringValue];\r\n\r\n NSNumber *v2 = [NSNumber numberWithDouble:NAN];\r\n className = NSStringFromClass([v2 class]); \r\n test = [v2 stringValue];\r\n \r\n NSNumber *v3 = [NSNumber numberWithDouble:[v1 doubleValue]];\r\n className = NSStringFromClass([v3 class]); \r\n test = [v3 stringValue];\r\n{code}\r\n\r\nWhen this is run from XCode, note the following values (in order of being set):\r\n\r\n1. value of classname is 'NSDecimalNumber'\r\n2. value of test is 'NaN'\r\n3. value of classname is '__NSCFNumber'\r\n4. value of test is 'nan'\r\n5. value of classname is '__NSCFNumber'\r\n6. value of test is 'nan'\r\n\r\nNot sure if that helps pinpoint the issue.\r\n", "attachment": [], "flagged": false, "summary": "iOS: Parity issue with 'NaN'", "creator": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "environment": "SDK build: 2.1.0.v20120618104311\r\nModule: ti.cloud 2.1.0\r\nxcode: 4.3.2", "comment": { "comments": [ { "id": "203007", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR 2539 against master", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-07-12T13:26:29.000+0000", "updated": "2012-07-12T13:26:29.000+0000" }, { "id": "203018", "author": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "body": "The PR addresses the symptom and not the root of the problem. It only masks the problem when logging the value via Ti.API.info, but will still fail when the value is being serialized internally. The conversion of the data value in the HTTPClient.send method does not call 'logMessage', so this PR will not resolve that issue. \r\n\r\nThe calls to Ti.API.info in the example code demonstrates that what should be the same value (NaN) is being treated differently in the 2 cases. ", "updateAuthor": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "created": "2012-07-12T13:56:23.000+0000", "updated": "2012-07-12T14:00:29.000+0000" }, { "id": "203149", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Accepted PR 2551 against master\r\nhttps://github.com/appcelerator/titanium_mobile/pull/2551", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-07-13T10:51:35.000+0000", "updated": "2012-07-13T10:51:35.000+0000" }, { "id": "213731", "author": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Re-opening to edit label", "updateAuthor": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-09T23:04:48.000+0000", "updated": "2012-08-09T23:04:48.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }