{ "id": "165617", "key": "TIMOB-24359", "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": "2017-01-31T19:35:52.000+0000", "created": "2017-01-31T18:42:14.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-03-24T18:04: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": [], "description": "h6. Description\r\n\r\nCan not add the phone number to the contact list using [setPhone|http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Contacts.Person-method-setPhone] method.\r\n\r\nh6. Steps To Reproduce\r\n1. Just run the following code to the device.\r\n2. Click the add button then check the phone contact.\r\n\r\n{code:title=app.js}\r\nvar win = Titanium.UI.createWindow({\r\n\ttitle : 'Add Phone',\r\n\tbackgroundColor : '#fff',\r\n\tlayout : 'vertical'\r\n});\r\n\r\n// Create a Button.\r\nvar add = Ti.UI.createButton({\r\n\ttitle : 'Add Number',\r\n\theight : Ti.UI.SIZE,\r\n\twidth : Ti.UI.SIZE,\r\n\ttop : 50,\r\n\r\n});\r\n\r\nvar person = Ti.Contacts.createPerson({\r\n\tfirstName : 'fname',\r\n\tlastName : 'lname',\r\n\r\n});\r\n\r\n// Listen for click events.\r\nadd.addEventListener('click', function() {\r\n\r\n\tvar number = {\r\n\t\tphone : {\r\n\t\t\tmobile : ['01723306519']\r\n\r\n\t\t}\r\n\t};\r\n\r\n\tperson.setPhone(number);\r\n\r\n\tTi.API.info('Contact saved');\r\n});\r\n\r\n// Add to the parent view.\r\nwin.add(add);\r\n\r\nwin.open();\r\n\r\n{code}\r\n{code:title=error}\r\n[ERROR] : Script Error {\r\n[ERROR] : column = 17;\r\n[ERROR] : line = 32;\r\n[ERROR] : message = \"*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray\";\r\n[ERROR] : stack = \"[native code]\\n\";\r\n[ERROR] : }\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "iOS: Can not add number to the contact list using setPhone method.", "creator": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.12.2\r\nNode.js\r\n Node.js Version = 4.6.2\r\n npm Version = 2.15.11\r\nTitanium CLI\r\n CLI Version = 5.0.11\r\nTitanium SDK\r\n SDK Version = 6.0.1.GA\r\n Target Platform = iphone v10.2", "comment": { "comments": [ { "id": "405882", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "The \"phone\" argument should be set when creating the person, I don't think the (manual) setters should even be in the docs. Better:\r\n{code:js}\r\nTi.Contacts.createPerson({\r\n firstName: 'Hans',\r\n lastName: 'Knoechel',\r\n phone: {\r\n mobile: ['+49 1723306519'],\r\n }\r\n});\r\n{code}\r\nPlease give it a try.\r\n\r\n*EDIT*: And for the case it has to be added to an existing contact, we'd need to investigate it.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-31T19:20:38.000+0000", "updated": "2017-01-31T19:22:25.000+0000" }, { "id": "405891", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "This ticket is invalid. The \"phone\" key should not be there of course, you are already specifying the property to set in the setter. Working code:\r\n{code:js}\r\nvar win = Titanium.UI.createWindow({\r\n\ttitle : 'Add Phone',\r\n\tbackgroundColor : '#fff',\r\n\tlayout : 'vertical'\r\n});\r\n \r\n// Create a Button.\r\nvar add = Ti.UI.createButton({\r\n\ttitle : 'Add Number',\r\n\theight : Ti.UI.SIZE,\r\n\twidth : Ti.UI.SIZE,\r\n\ttop : 50,\r\n \r\n});\r\n \r\nvar person = Ti.Contacts.createPerson({\r\n\tfirstName : 'fname',\r\n\tlastName : 'lname',\r\n \r\n});\r\n \r\n// Listen for click events.\r\nadd.addEventListener('click', function() {\r\n \r\n\tvar number = {\r\n\t\tmobile : ['01723306519'] \r\n\t};\r\n \r\n\tperson.setPhone(number);\r\n \r\n\tTi.API.info('Contact saved');\r\n});\r\n \r\n// Add to the parent view.\r\nwin.add(add);\r\n \r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-31T19:35:52.000+0000", "updated": "2017-01-31T19:35:52.000+0000" }, { "id": "415621", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-24T18:04:06.000+0000", "updated": "2017-03-24T18:04:06.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }