{ "id": "153290", "key": "TIMOB-20013", "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": "17072", "name": "Release 5.1.2", "archived": false, "released": true, "releaseDate": "2016-01-12" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-11-23T21:58:36.000+0000", "created": "2015-11-18T20:11:58.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "contacts", "qe-5.1.0" ], "versions": [ { "id": "14826", "description": "Release 5.1.0-remaining iOS9 features, Android M features", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-11-20" } ], "issuelinks": [ { "id": "49889", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "153254", "key": "TIMOB-20010", "fields": { "summary": "iOS9: Remove Contacts causes app to crash", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2015-11-26T03:49:09.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": "h5. Description:\r\nCreating a new contact with {{Ti.createContact()}} & including the {{relatedNames}} will cause the following error when build to an iOS8 Device / Sim:\r\n\r\n{code:java}\r\n[ERROR] : Script Error {\r\n[ERROR] : column = 33;\r\n[ERROR] : line = 155;\r\n[ERROR] : message = \"-[__NSCFString countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x17023e340\";\r\n[ERROR] : sourceURL = \"\";\r\n[ERROR] : stack = \"[native code]\";\r\n[ERROR] : }\r\n{code}\r\n\r\nThe same code will work successfully when build to an iOS9 Device / Sim, and removing the {{relatedNames}} property resolves the issue for iOS8. \r\n\r\nh5. Steps to reproduce:\r\n\r\n1. Create a Classic Project.\r\n2. Include following demo code to app.js:\r\n{code:java}\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff'\r\n});\r\n\r\n\tTi.Contacts.requestAuthorization(function(e) {\r\n\t\tif (e.success == true) {\r\n\t\t\talert('success');\r\n\t\t}\r\n\t\telse {\r\n\t\t\talert('no');\r\n\t\t}\r\n\t});\r\n\r\n \r\n\r\n\r\nvar createContact = Ti.UI.createButton({\r\n\ttitle: \"Create New Contact\",\r\n});\r\n\r\n\r\n\r\ncreateContact.addEventListener('click',function(e){\r\n\t pong = Ti.Contacts.createPerson({\r\n \t\tfirstName: 'letter',\r\n \t\tlastName: 'pong',\r\n \t\tmiddleName: 'long',\r\n \t\tnickname: 'fancyPants',\r\n \t\tprefix: 'Mr',\r\n \t\tsuffix: 'Jr',\r\n \t\tfirstPhonetic: 'a',\r\n \t\tmiddlePhonetic: 'b',\r\n \t\tlastPhonetic: 'c',\r\n \t\torganization: 'appcelerator',\r\n \t\tdepartment: 'SDK',\r\n \t\tjobTitle: 'pingPongChampion',\r\n \t\tnote: 'when i was young, i ping pong to the top',\r\n \t\tkind: Ti.Contacts.CONTACTS_KIND_PERSON,\r\n \t\taddress:{\r\n \twork:[\r\n\t {\r\n\t CountryCode: 'gb', // determines how the address is displayed\r\n\t Street: '200 Brook Drive\\nGreen Park',\r\n\t City: 'Reading',\r\n\t Country: 'England',\r\n\t PostalCode: 'RG2 6UB'\r\n\t },\r\n\t {\r\n\t CountryCode: 'gb', // determines how the address is displayed\r\n\t Street: '1 St Pauls Road\\nClerkenwell',\r\n\t City: 'City of London',\r\n\t State: 'London',\r\n\t Country: 'England',\r\n\t PostalCode: 'EC1 1AA'\r\n\t }\r\n\t ],\r\n\t home:[\r\n\t {\r\n\t CountryCode: 'gb', // determines how the address is displayed\r\n\t Street: '2 Boleyn Court',\r\n\t City: 'London',\r\n\t State: 'Greenwich',\r\n\t Country: 'England',\r\n\t PostalCode: 'SE10'\r\n\t }\r\n\t ]\r\n\t },\r\n\t email:{\r\n home : [\r\n 'myGmail',\r\n 'myHotmail'\r\n ],\r\n work : [\r\n 'myWorkemail'\r\n ]\r\n \t},\r\n \t relatedNames:{\r\n \t \tfather: 'baba',\r\n \t \tmother: 'mama',\r\n \t \tchild: 'gaga'\r\n \t },\r\n\t birthday: '2012-01-01T12:00:00.000+0000',\r\n\t instantMessage:{\r\n\t home:[\r\n\t {\r\n\t service: 'AIM',\r\n\t username: 'leisureAIM'\r\n\t },\r\n\t {\r\n\t service: 'MSN',\r\n\t username: 'no_paul_here@msn.com'\r\n\t }\r\n\t ],\r\n\t work:[\r\n\t {\r\n\t service: 'AIM',\r\n\t username: 'seriousAIM'\r\n\t }\r\n\t ]\r\n\t },\r\n\t organization: 'Appcelerator',\r\n\t phone:{\r\n\t main: ['07900 000001', '07900 000002'],\r\n\t iPhone: ['+44 (0)118 925 6128', '+44 (0)118 000 0000']\r\n\t },\r\n\t alternateBirthday: {\r\n calendarIdentifier: 'chinese',\r\n day: 25,\r\n era: 78,\r\n isLeapMonth: false,\r\n month: 11,\r\n year: 16\r\n },\r\n socialProfile:{\r\n\t home:[{\r\n\t service: 'facebook',\r\n\t username: 'jdeep@facebook.com'\r\n\t },\r\n\t {\r\n\t service: 'gamecenter',\r\n\t username: 'jdeep@hotmail.com'\r\n\t }],\r\n\t work:[{\r\n\t service: 'linkedin',\r\n\t username: 'jdeep@linkedin.com'\r\n\t }]\r\n },\r\n \r\n\t url:{\r\n\t homepage: ['www.google.com'],\r\n\t work: ['www.appcelerator.com', 'www.example.com']\r\n\t },\r\n\t date:{\r\n\t \tanniversary: ['2006-06-25T12:00:00.000+0000','2007-06-25T12:00:00.000+0000'],\r\n\t \tother: ['2009-03-25T12:00:00.000+0000']\r\n\t }\r\n\t});\r\n \r\n});\r\n\r\n\r\nwin1.add(createContact);\r\nwin1.open();\r\n\r\n{code}\r\n4. Build to iOS8 device / sim\r\n5. Receive above error.\r\n6. Remove {{relatedNames}} property.\r\n7. Build to IOS8 device / sim.\r\n8. Create Contacts works successfully.\r\n\r\nh5. Result:\r\nCreate Contacts will crash and return aforementioned error on iOS8.\r\n\r\nh5. Expected Result:\r\nCreate contacts should work successfully on iOS8, or return a warning to exclude the relatedName property when building for iOS8.", "attachment": [], "flagged": false, "summary": "iOS8: Ti.Contacts - relatedNames property causes crash", "creator": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "environment": "Mac OSX El Capitan 10.11 (15A284)\r\nSDK: 5.1.0.v20151118092752\r\nStudio: 4.4.0.201511130407\r\nCore CLI: 5.1.0-60\r\nNPM CLI: 4.2.1 GA\r\nXcode 7.1(7B91b)\r\nNode: 0.12.7\r\nPreproduction", "closedSprints": [ { "id": 529, "state": "closed", "name": "2015 Sprint 24 SDK", "startDate": "2015-11-21T01:30:12.670Z", "endDate": "2015-12-05T01:30:00.000Z", "completeDate": "2015-12-07T03:57:17.094Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "370765", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "The sample code is wrong. As according to the docs, relatedNames expect a dictionary of keys with values that are ARRAYs. HOWEVER, this also uncovered that the iOS9 implementation is wrong, fix coming shortly.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-18T23:27:51.000+0000", "updated": "2015-11-18T23:27:51.000+0000" }, { "id": "370771", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Master PR: https://github.com/appcelerator/titanium_mobile/pull/7467\r\n5_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/7468 (Do not merge until 5.1.0.GA released)\r\n\r\nh4. To test:\r\nUse the above sample code, but relatedNames should be \r\n{code}\r\nrelatedNames:{\r\n \t \tfather: ['baba1','baba2'],\r\n \t \tmother: ['mama'],\r\n \t \tchild: ['gaga']\r\n \t }\r\n{code}", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-19T00:00:37.000+0000", "updated": "2015-11-19T00:00:57.000+0000" }, { "id": "371237", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Alright. The functionality works now, but only when modifying the provided demo code with the values of the last comment. I cleaned up the test case and provided some more details to check (null check after contact creation, 5.1.0 method for requesting permissions).\r\n\r\nUpdated demo code (as stated in the docs): https://gist.github.com/hansemannn/01f37c1fc6f31e818abd", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-23T21:44:31.000+0000", "updated": "2015-11-23T21:44:31.000+0000" }, { "id": "371246", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, built the sample code using SDK {{5.1.1.v20151123140433}} to iOS9 device after modifying the relatedNames to the correct implementation. The contact was created successfully and the relatedNames fields have been saved correctly. \r\n\r\nTested with: \r\nDevices: iPhones 6S+ (9.1) \r\nSimulators: (9.1) & (8.4) \r\nMac OSX El Capitan 10.11 (15A284)\r\nTi SDK: 5.1.1.v20151123140433\r\nAppc Studio: 4.4.0.201511182122\r\nAppc NPM: 4.2.2\r\nAppc CLI: 5.1.0-60\r\nAlloy: 1.7.26\r\nXcode 7.1(7B91b)\r\nNode v0.12.7\r\n\r\n*Closing ticket.*", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2015-11-23T22:23:37.000+0000", "updated": "2015-11-23T22:23:37.000+0000" }, { "id": "371510", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "To Note: This ticket is marked 5.1.2 but PR was merged in 5.1.1GA", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-26T03:49:09.000+0000", "updated": "2015-11-26T03:49:09.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }