{ "id": "101149", "key": "TIMOB-11399", "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": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "14700", "description": "2012 Sprint 25", "name": "2012 Sprint 25", "archived": true, "released": true, "releaseDate": "2012-12-17" }, { "id": "14784", "description": "2012 Sprint 25 API", "name": "2012 Sprint 25 API", "archived": true, "released": true, "releaseDate": "2012-12-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-06-21T10:29:20.000+0000", "created": "2012-09-14T04:13:12.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "insight", "module_app_properties", "parity", "qe-testadded" ], "versions": [], "issuelinks": [ { "id": "26862", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "111442", "key": "TIMOB-13127", "fields": { "summary": "iOS: Properties.setList - Ti.App.Properties.setList cannot save arrays that contain null, undefined, or empty values", "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": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2013-06-21T10:29:20.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": "h6.Problem\r\nWhen trying to set an object in the client side properties by using \"Ti.App.Properties.setObject()\", the object that contains a key that has a null value it won't be saved.\r\n\r\nh6.Actual result\r\nWhen replacing the 'something' -key with a non-null value, the property however CAN be saved.\r\n\r\nh6.Repro sequence\r\n{code}\r\nvar win = Ti.UI.createWindow({ backgroundColor: 'white' });\r\n \r\nvar objectWithNullValue = {\r\n expires_at: 1347623585,\r\n value: {\r\n something: null\r\n }\r\n};\r\n\r\nvar objectWithoutNullValue = {\r\n expires_at: 1347623585,\r\n value: {\r\n something: 'value'\r\n }\r\n};\r\n \r\nTi.App.Properties.setObject('Object1', objectWithNullValue);\r\nTi.App.Properties.setObject('Object2', objectWithoutNullValue); \r\n \r\n \r\nTi.API.info('----- object 1 -----');\r\nTi.API.info(Ti.App.Properties.getObject('Object1'));\r\nTi.API.info('Type of Object1: ' + typeof Ti.App.Properties.getObject('Object1'));\r\nTi.API.info('Value of Object1: ' + Ti.App.Properties.getObject('Object1'));\r\nTi.API.info('Stringified value of Object1: ' + JSON.stringify(Ti.App.Properties.getObject('Object1')));\r\n \r\nTi.API.info('----- object 2 -----');\r\nTi.API.info(Ti.App.Properties.getObject('Object2'));\r\nTi.API.info('Type of Object2: ' + typeof Ti.App.Properties.getObject('Object2'));\r\nTi.API.info('Value of Object2: ' + Ti.App.Properties.getObject('Object2'));\r\nTi.API.info('Stringified value of Object2: ' + JSON.stringify(Ti.App.Properties.getObject('Object2')));\r\n \r\nwin.open();\r\n\r\nTi.API.info('----- My name -----');\r\nTi.App.Properties.setObject( \"object\" , { name: \"eduardo\" , lastName: null } );\r\nTi.API.info(Ti.App.Properties.getObject('object'));\r\n{code}\r\n\r\nh6.iOS Console output\r\n{code}\r\n[INFO] Detected third-party module: ti.location/1.0\r\n[INFO] Titanium SDK version: 3.0.0 (10/08/12 21:09 7bf73ff)\r\n[INFO] iPhone Device family: universal\r\n[INFO] iPhone SDK version: 5.1\r\n[INFO] iPhone simulated device: iphone\r\n[WARN] The project seems to be having custom info.plist which does not contain the `CFBundleShortVersionString` key\r\n[INFO] Generating the missing `CFBundleShortVersionString` key\r\n[INFO] Minimum iOS version: 4.0 Linked iOS Version 5.1\r\n[INFO] Launching application in Simulator\r\n[INFO] Launched application in Simulator (5.11 seconds)\r\n[INFO] Application started\r\n[INFO] 1BestPractices/1.0 (3.0.0.v20121008210903.7bf73ff)\r\n[INFO] ----- object 1 -----\r\n[INFO] {\r\n value = {\r\n };\r\n}\r\n[INFO] Type of Object1: object\r\n[INFO] Value of Object1: [object Object]\r\n[INFO] Stringified value of Object1: {\"value\":{}}\r\n[INFO] ----- object 2 -----\r\n[INFO] {\r\n \"expires_at\" = 1347623585;\r\n value = {\r\n something = value;\r\n };\r\n}\r\n[INFO] Type of Object2: object\r\n[INFO] Value of Object2: [object Object]\r\n[INFO] Stringified value of Object2: {\"expires_at\":1347623585,\"value\":{\"something\":\"value\"}}\r\n[INFO] ----- My name -----\r\n2012-10-11 17:12:48.872 1BestPractices[6080:1a903] *** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '{\r\n lastName = \"\";\r\n name = eduardo;\r\n}' of class '__NSCFDictionary'. Note that dictionaries and arrays in property lists must also contain only property values.\r\n[INFO] \r\n{code}\r\n\r\nh6.Android Console logs\r\n{code}\r\n10-11 17:12:29.501: I/TiApplication(3486): (main) [0,0] checkpoint, app created.\r\n10-11 17:12:29.540: I/TiApplication(3486): (main) [37,37] Titanium 3.0.0 (2012/10/08 21:09 7bf73ff)\r\n10-11 17:12:29.704: I/TiDbHelper(3486): (main) [171,208] No value in database for platform key: 'unique_machine_id' returning supplied default ''\r\n10-11 17:12:29.712: I/TiDbHelper(3486): (main) [4,212] No value in database for platform key: 'hardware_machine_id' returning supplied default ''\r\n10-11 17:12:29.766: I/TiApplication(3486): (main) [58,270] Titanium Javascript runtime: v8\r\n10-11 17:12:29.774: D/dalvikvm(3486): Trying to load lib /data/data/com.appc.test/lib/libstlport_shared.so 0x4051ccb8\r\n10-11 17:12:29.774: D/dalvikvm(3486): Added shared lib /data/data/com.appc.test/lib/libstlport_shared.so 0x4051ccb8\r\n10-11 17:12:29.774: D/dalvikvm(3486): No JNI_OnLoad found in /data/data/com.appc.test/lib/libstlport_shared.so 0x4051ccb8, skipping init\r\n10-11 17:12:29.774: D/dalvikvm(3486): Trying to load lib /data/data/com.appc.test/lib/libkroll-v8.so 0x4051ccb8\r\n10-11 17:12:29.790: D/dalvikvm(3486): Added shared lib /data/data/com.appc.test/lib/libkroll-v8.so 0x4051ccb8\r\n10-11 17:12:29.821: I/TiRootActivity(3486): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null\r\n10-11 17:12:29.852: I/TiAnalyticsDb(3486): (main) [35,35] Upgrading Database from 1 to 4\r\n10-11 17:12:30.016: E/TiApplication(3486): (KrollRuntimeThread) [159,194] APP PROXY: ti.modules.titanium.app.AppModule@405e3f90\r\n10-11 17:12:30.094: I/TiAPI(3486): ----- object 1 -----\r\n10-11 17:12:30.094: I/TiAPI(3486): [object Object]\r\n10-11 17:12:30.094: I/TiAPI(3486): Type of Object1: object\r\n10-11 17:12:30.094: I/TiAPI(3486): Value of Object1: [object Object]\r\n10-11 17:12:30.094: I/TiAPI(3486): Stringified value of Object1: {\"expires_at\":1347623585,\"value\":{\"something\":null}}\r\n10-11 17:12:30.094: I/TiAPI(3486): ----- object 2 -----\r\n10-11 17:12:30.094: I/TiAPI(3486): [object Object]\r\n10-11 17:12:30.094: I/TiAPI(3486): Type of Object2: object\r\n10-11 17:12:30.094: I/TiAPI(3486): Value of Object2: [object Object]\r\n10-11 17:12:30.094: I/TiAPI(3486): Stringified value of Object2: {\"expires_at\":1347623585,\"value\":{\"something\":\"value\"}}\r\n10-11 17:12:30.110: D/LSAPP_TelMon(783): onCellTowerChanged CDMA :: {\"NetTyp\":\"CDMA\",\"BaseStnLat\":\"2147483647\",\"NetOp\":\"33404\",\"BaseStnId\":\"623\",\"BaseStnLng\":\"2147483647\",\"CntryISO\":\"mx\",\"NetId\":\"0\",\"SysId\":\"24587\"}\r\n10-11 17:12:30.126: D/LSAPP_TelMon(783): Telmon : celltower changed...new cell...clear bouncing cells upon new cell and no pending timer \r\n10-11 17:12:30.126: D/LSAPP_TelMon(783): emptyBouncingCells :: \r\n10-11 17:12:30.173: I/TiAPI(3486): ----- My name -----\r\n10-11 17:12:30.180: I/TiAPI(3486): [object Object]\r\n{code}\r\n\r\nh6.Associated Community thread\r\nhttp://developer.appcelerator.com/question/139212/sdk-210-propertiessetobject-error-when-setting-null\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: Ti.App.Properties.setObject cannot save object with null values in it", "creator": { "name": "gnoesiboe", "key": "gnoesiboe", "displayName": "Gijs Nieuwenhuis", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "gnoesiboe", "key": "gnoesiboe", "displayName": "Gijs Nieuwenhuis", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK: 2.1.2.GA & 3.0 CI build \r\niOS 5.1", "comment": { "comments": [ { "id": "218965", "author": { "name": "gnoesiboe", "key": "gnoesiboe", "displayName": "Gijs Nieuwenhuis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Can't seem to save it with Ti.App.Properties.setList() either when the object has null values..", "updateAuthor": { "name": "gnoesiboe", "key": "gnoesiboe", "displayName": "Gijs Nieuwenhuis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-14T04:16:28.000+0000", "updated": "2012-09-14T04:16:28.000+0000" }, { "id": "219752", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "body": "@Gijs Nieuwenhuis What is your iOS version? Can you paste an actual sample to test this including your console output?\r\n\r\n\"Ti.App.Properties.setObject()\" can save null values as per sample below:\r\n\r\nh6.repro sequence\r\n{code}\r\nvar win = Ti.UI.createWindow({ backgroundColor: 'white' });\r\n \r\nTi.App.Properties.setBool('boolValue1', true);\r\nTi.API.info('The value of the boolValue1 property is: ' + Ti.App.Properties.getBool('boolValue1'));\r\n \r\nTi.App.Properties.setBool('boolValue2', false);\r\nTi.API.info('The value of the boolValue2 property is: ' + Ti.App.Properties.getBool('boolValue2'));\r\n \r\nTi.App.Properties.setBool('boolValue3', null);\r\nTi.API.info('The value of the boolValue3 property is: ' + Ti.App.Properties.getBool('boolValue3'));\r\n \r\nTi.App.Properties.setBool('boolValue4', undefined);\r\nTi.API.info('The value of the boolValue4 property is: ' + Ti.App.Properties.getBool('boolValue4'));\r\n\r\nvar savedObject = {\r\n expires_at: 1347623585,\r\n value: {\r\n something: null\r\n }\r\n};\r\n\r\nTi.App.Properties.setObject(savedObject, null);\r\nTi.API.info('The value of the Object1 property is: ' + Ti.App.Properties.getObject(savedObject));\r\n \r\nTi.App.Properties.setObject('Object2', undefined);\r\nTi.API.info('The value of the Object2 property is: ' + Ti.App.Properties.getObject('Object2'));\r\n \r\nwin.open();\r\n{code}\r\n\r\nh6.Console output\r\n{code}\r\n[INFO] One moment, building ...\r\n[INFO] Detected third-party module: ti.location/1.0\r\n[INFO] Detected third-party module: ti.location/1.0\r\n[INFO] Titanium SDK version: 2.1.2 (08/24/12 14:46 ed7f777)\r\n[INFO] iPhone Device family: universal\r\n[INFO] iPhone SDK version: 5.1\r\n[INFO] iPhone simulated device: iphone\r\n[WARN] The project seems to be having custom info.plist which does not contain the `CFBundleShortVersionString` key\r\n[INFO] Generating the missing `CFBundleShortVersionString` key\r\n[INFO] Minimum iOS version: 4.0\r\n[INFO] Launching application in Simulator\r\n[INFO] Launched application in Simulator (4.40 seconds)\r\n[INFO] Application started\r\n[INFO] 1BestPractices/1.0 (2.1.2.GA.ed7f777)\r\n[INFO] The value of the boolValue1 property is: true\r\n[INFO] The value of the boolValue2 property is: false\r\n[INFO] The value of the boolValue3 property is: null\r\n[INFO] The value of the boolValue4 property is: null\r\n[INFO] The value of the Object1 property is: null\r\n[INFO] The value of the Object2 property is: null\r\n{code}\r\n", "updateAuthor": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-09-19T10:52:46.000+0000", "updated": "2012-09-19T10:52:46.000+0000" }, { "id": "221110", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "body": "It's been a week now, closing due to age in no response.", "updateAuthor": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-09-26T21:48:28.000+0000", "updated": "2012-09-26T21:48:28.000+0000" }, { "id": "222879", "author": { "name": "gnoesiboe", "key": "gnoesiboe", "displayName": "Gijs Nieuwenhuis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Eduardo, i've been away for a while so I couldn't respond within the required timespan. Anyway, I tested your code and below my console output.\n\n{code}\n[INFO] One moment, building ...\n[INFO] Titanium SDK version: 2.1.0 (06/28/12 12:16 6e3cab6)\n[INFO] iPhone Device family: universal\n[INFO] iPhone SDK version: 6.0\n[INFO] iPhone simulated device: iphone\n[INFO] Launching application in Simulator\ndyld: DYLD_ environment variables being ignored because main executable (/usr/bin/osascript) is code signed with entitlements\n[INFO] Launched application in Simulator (14.57 seconds)\n[INFO] Application started\n[INFO] TestProject/1.0 (2.1.0.GA.6e3cab6)\n[INFO] The value of the boolValue1 property is: true\n[INFO] The value of the boolValue2 property is: false\n[INFO] The value of the boolValue3 property is: null\n[INFO] The value of the boolValue4 property is: null\n[INFO] The value of the Object1 property is: null\n[INFO] The value of the Object2 property is: null\n{code}\n\nHowever, I don't really get what you're trying to test with these lines as you are not using the setObject method like it is meant to be used (see http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Titanium.App.Properties-method-setObject) when trying to save the savedObject property in the client side properties. I rewrote the code a bit to show you my problem:\n\n{code}\nvar win = Ti.UI.createWindow({ backgroundColor: 'white' });\n \nvar objectWithNullValue = {\n expires_at: 1347623585,\n value: {\n something: null\n }\n};\n\nvar objectWithoutNullValue = {\n expires_at: 1347623585,\n value: {\n something: 'value'\n }\n};\n \nTi.App.Properties.setObject('Object1', objectWithNullValue);\nTi.App.Properties.setObject('Object2', objectWithoutNullValue);\n\nTi.API.info('----- object 1 -----');\nTi.API.info(Ti.App.Properties.getObject('Object1'));\nTi.API.info('Type of Object1: ' + typeof Ti.App.Properties.getObject('Object1'));\nTi.API.info('Value of Object1: ' + Ti.App.Properties.getObject('Object1'));\nTi.API.info('Stringified value of Object1: ' + JSON.stringify(Ti.App.Properties.getObject('Object1')));\n\nTi.API.info('----- object 2 -----');\nTi.API.info(Ti.App.Properties.getObject('Object2'));\nTi.API.info('Type of Object2: ' + typeof Ti.App.Properties.getObject('Object2'));\nTi.API.info('Value of Object2: ' + Ti.App.Properties.getObject('Object2'));\nTi.API.info('Stringified value of Object2: ' + JSON.stringify(Ti.App.Properties.getObject('Object2')));\n\nwin.open();\n{code}\n\nConsole output when I execute these lines:\n{code}\n[INFO] One moment, building ...\n[INFO] Titanium SDK version: 2.1.3 (10/02/12 16:16 15997d0)\n[INFO] iPhone Device family: universal\n[INFO] iPhone SDK version: 6.0\n[INFO] iPhone simulated device: iphone\n[INFO] Performing full rebuild. This will take a little bit. Hold tight...\n[INFO] Minimum iOS version: 4.3 Linked iOS Version 6.0\n[INFO] Performing clean build\n[INFO] Launching application in Simulator\n[INFO] Launched application in Simulator (34.45 seconds)\n[INFO] Application started\n[INFO] TestProject/1.0 (2.1.3.GA.15997d0)\n[INFO] ----- object 1 -----\n[INFO] \n[INFO] Type of Object1: object\n[INFO] Value of Object1: null\n[INFO] Stringified value of Object1: null\n[INFO] ----- object 2 -----\n[INFO] {\n \"expires_at\" = 1347623585;\n value = {\n something = value;\n };\n}\n[INFO] Type of Object2: object\n[INFO] Value of Object2: [object Object]\n[INFO] Stringified value of Object2: {\"expires_at\":1347623585,\"value\":{\"something\":\"value\"}}\n{code}\n\nMijn environment info:\n* iPhone SDK version: 6.0\n* Titanium SDK: 2.1.3 GA\n\nAs you can see the application doesn't crash, however objects are still not saved when they have null values in them. Please reopen this issue.\n\n", "updateAuthor": { "name": "gnoesiboe", "key": "gnoesiboe", "displayName": "Gijs Nieuwenhuis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-10-10T08:08:05.000+0000", "updated": "2012-10-10T08:08:05.000+0000" }, { "id": "223197", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Added labels, test case updated & logs appended.\r\n\r\nMoving to main project to dig into it.", "updateAuthor": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-10-11T22:25:08.000+0000", "updated": "2012-10-11T22:25:08.000+0000" }, { "id": "229925", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending https://github.com/appcelerator/titanium_mobile/pull/3523", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-12-04T20:20:07.000+0000", "updated": "2012-12-04T20:20:07.000+0000" }, { "id": "235327", "author": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Ti.App.Properties.setObject can save object with null values in it.\r\n\r\nVerified on :\r\nSDK version: 3.1.0.v20130111163212\r\nCLI version : 3.0.23\r\nOS : MAC OSX 10.7.5\r\nXCode : 4.5.1", "updateAuthor": { "name": "pmishra", "key": "pmishra", "displayName": "Paras Mishra", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-01-22T12:12:39.000+0000", "updated": "2013-01-22T12:12:39.000+0000" }, { "id": "258970", "author": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening just to update label", "updateAuthor": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-21T10:25:03.000+0000", "updated": "2013-06-21T10:25:03.000+0000" }, { "id": "258971", "author": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Updated label and verified.\r\nTested on:\r\nDevice: Nexus 7 tab Android Version 4.1\r\nand Simulator 6.0\r\nSDK:3.1.2.v20130619101604\r\nAppcelerator Studio: 3.1.1.201306131423\r\nOS: OSX 10.8\r\nacs:1.0.3\r\nalloy:1.1.3\r\nnpm:1.2.14\r\ntitanium:3.1.1\r\ntitanium-code-processor:1.0.1", "updateAuthor": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-21T10:29:20.000+0000", "updated": "2013-06-21T10:29:20.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }