{ "id": "120765", "key": "TIMOB-15391", "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": "15972", "description": "Release 3.4.0", "name": "Release 3.4.0", "archived": false, "released": true, "releaseDate": "2014-09-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-09-04T06:21:15.000+0000", "created": "2013-10-03T11:00:57.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "qe-closed-3.4.0", "supportTeam" ], "versions": [ { "id": "15593", "description": "Release 3.1.3", "name": "Release 3.1.3", "archived": true, "released": true, "releaseDate": "2013-09-18" }, { "id": "15856", "description": "Release 3.2.1", "name": "Release 3.2.1", "archived": false, "released": true, "releaseDate": "2014-02-10" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-09-11T11:02: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": "h2. Description of the problem\r\nRunning the sample code in the documentation, when the user tries to add a contact and does not allow the app to access the Contacts, the app crashes. This is because the callback of Ti.Contacts.requestAuthorization always has e.success set to true.\r\n\r\nh2. Steps to reproduce\r\nUsing the code below, just click on the label and click on \"Don't Allow\". The app crashes.\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : '#ffffff'\r\n});\r\n\r\nvar lbl = Ti.UI.createLabel({\r\n text : \"click to add a contact\"\r\n});\r\nwin.add(lbl);\r\n\r\nlbl.addEventListener('click', function(e) {\r\n var performAddressBookFunction = function() {\r\n Ti.Contacts.createPerson({\r\n firstName : 'John',\r\n lastName : 'Doe',\r\n organization : 'Appcelerator',\r\n phone : {\r\n mobile : ['07900 000001', '07900 000002']\r\n }\r\n });\r\n };\r\n var addressBookDisallowed = function() {\r\n alert(\"not allowed\");\r\n };\r\n if (Ti.Contacts.contactsAuthorization == Ti.Contacts.AUTHORIZATION_AUTHORIZED) {\r\n performAddressBookFunction();\r\n } else if (Ti.Contacts.contactsAuthorization == Ti.Contacts.AUTHORIZATION_UNKNOWN) {\r\n Ti.Contacts.requestAuthorization(function(e) {\r\n if (e.success) {\r\n performAddressBookFunction();\r\n } else {\r\n addressBookDisallowed();\r\n }\r\n });\r\n } else {\r\n addressBookDisallowed();\r\n }\r\n});\r\nwin.open();\r\n{code}\r\n\r\nh2. Note\r\nYou might add a check for Ti.Contacts.contactsAuthorization == Ti.Contacts.AUTHORIZATION_AUTHORIZED in the callback to avoid the issue. From the docs, is not fully clear if the callback should return e.success=true only if the user allows. The sample is the same as above.", "attachment": [], "flagged": false, "summary": "iOS: Ti.Contacts.requestAuthorization always returns e.success=true in the callback, even if the users doesn't allow", "creator": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "SDK 3.1.3, 3.2.1.GA \r\n\r\nTI CLI 3.2.1\r\n\r\niOS 7", "comment": { "comments": [ { "id": "273979", "author": { "name": "kosso", "key": "kosso", "displayName": "kosso", "active": true, "timeZone": "Europe/London" }, "body": "Tested and confirmed. \r\n\r\nIf you add Ti.API.info(e); after line 27 to trace the request event result, you will see success = 1, even if you click Don't Allow.\r\n\r\n\r\n\r\n", "updateAuthor": { "name": "kosso", "key": "kosso", "displayName": "kosso", "active": true, "timeZone": "Europe/London" }, "created": "2013-10-07T08:41:29.000+0000", "updated": "2013-10-07T08:41:29.000+0000" }, { "id": "274012", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~dcassenti] Is this only on iOS 7?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-07T16:26:31.000+0000", "updated": "2013-10-07T16:26:31.000+0000" }, { "id": "274166", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Downgrading priority.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-08T15:55:47.000+0000", "updated": "2013-10-08T15:55:47.000+0000" }, { "id": "321733", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Bug exist with TiSDK 3.2.1.GA and 3.2.0 but cannot reproduce with 3.4.0 GA \r\nAppcelerator Studio, build: 3.3.0.201407111535 \r\niOS 7.0.3", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-04T06:22:51.000+0000", "updated": "2014-09-04T06:22:51.000+0000" }, { "id": "323044", "author": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified with :\r\nAppcelerator Studio:3.4.0.201409101253\r\nSdk:3.4.0.v20140910235714\r\nalloy:1.5.0-rc\r\ntitanium:3.4.0-rc\r\ntitanium-code-processor:1.1.1\r\nacs:1.0.16\r\nnpm:1.3.2\r\nOS:Maverick(10.9.4)\r\nxcode: Xcode6GMSeed \r\nDevice:iPhone5c(v8.0)\r\n\r\n\r\nUsing the above code, clicking on the label and then clicking on \"Don't Allow\". App not crashes.\r\nGetting Alert as \"not allowed\".\r\nWorking as expected. Hence closing the issue", "updateAuthor": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-11T11:01:48.000+0000", "updated": "2014-09-11T11:01:48.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }