{ "id": "63424", "key": "TIMOB-2792", "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": "11258", "description": "Holding Pen for Triaged Issues", "name": "Backlog", "archived": false, "released": false } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-08-27T12:56:11.000+0000", "created": "2011-04-15T03:29:41.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "defect", "facebook", "ios", "reported-1.6.0", "rplist" ], "versions": [ { "id": "11233", "name": "Release 1.6.0", "archived": true, "released": true, "releaseDate": "2011-02-23" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-20T16:59:32.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": "{html}

Problem

\n

If a user clicks \"Don't Allow\" when an app asks for additional\ninformation, evt.success and hasPermission will still return \"true\"\nfor this permission, when they should return false. This false\npositive only occurs in iOS, in my testing.

\n

Sample Code Demonstrating Problem

\n

The following sample code demonstrates the problem.

\n

Use the following steps to reproduce in sample code:
\n1. Click \"Connect with Facebook\"
\n2. Sign in
\n3. Click \"Don't Allow\"

\n
\n/**\n* Function that logs the user into Facebook, and makes sure they have\n* granted us the \"user_checkins\" permission.\n*/\nfunction checkIfUserIsLoggedIntoFacebook() {\n    // if user hasn't logged in yet, don't do anything\n    // (they need to click the \"Connect with Facebook\" button)\n    if (Titanium.Facebook.isLoggedIn() === false) {\n    }\n    // if the user hasn't given us the permissions we want, request them.\n    else if (!Titanium.Facebook.hasPermission(\"user_checkins\")) {\n        Titanium.Facebook.requestPermission(\"user_checkins\", function (evt) {\n            if (evt.success) {\n                alert('Permission GRANTED');\n            } else {\n                alert(\"Permission DENIED\");\n            }\n        });\n    }\n    // otherwise, we should be good to go\n    else {\n        alert('Permission ALREADY GRANTED');\n    }\n}\n\n/**\n* Add a login event listener so we can check if we have all the permissions\n* we want.\n*/\nTitanium.Facebook.addEventListener('login', function (evt) {\n    if (evt.success) {\n        checkIfUserIsLoggedIntoFacebook();\n    }\n});\n\n// create our window\nvar win = Ti.UI.createWindow({ backgroundColor: '#fff' });\nwin.add(Ti.Facebook.createLoginButton({\n    apikey: '645bf1d897d1fa8dc93ed45bc37edc04',\n    secret: '49d146f85b8429438262380b85f2ebac',\n    style: 'wide'\n}));\nwin.open();\n
\n

Tested On

\n

Tested on CI build 1.6.0 from January 8th, 2010.
\nBROKEN on iPhone Simulator, 4.2
\nWORKS on Android Simulator APIs 2.2

\n

Associated Helpdesk Ticket

\n

http://developer.appcelerator.com/helpdesk/view/63481

{html}", "attachment": [ { "id": "18215", "filename": "facebookrequestpermissionlog.rtf", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-04-15T03:29:42.000+0000", "size": 3481, "mimeType": "text/rtf" }, { "id": "18216", "filename": "fbconnect_perm.patch", "author": { "name": "jesush.christ", "key": "jesush.christ", "displayName": "Jesus H. Christ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:42.000+0000", "size": 640, "mimeType": "text/plain" } ], "flagged": false, "summary": "iOS: Facebook permissions return false positives", "creator": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "environment": "BROKEN on iPhone Simulator, 4.2; WORKS on Android Emulator APIs 2.2", "closedSprints": [ { "id": 695, "state": "closed", "name": "2016 Sprint 17 SDK", "startDate": "2016-08-13T00:00:16.620Z", "endDate": "2016-08-27T00:00:00.000Z", "completeDate": "2016-08-29T03:18:08.942Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "129425", "author": { "name": "jesush.christ", "key": "jesush.christ", "displayName": "Jesus H. Christ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

The easy fix for this (short of ripping out and replacing the\nFacebook module with new code, which is ideal) is to change one\nline in the FBConnect/FBDialog.m (line 391 in Mobile SDK\n1.5.1).

\n

The line should change FROM:

\n
\nif ([url.resourceSpecifier isEqualToString:@\"cancel\"]) {\n
\n

TO:

\n
\nif ([[url.resourceSpecifier substringToIndex:6] isEqualToString:@\"cancel\"]) {\n
\n

Attached is a patch file that accomplishes that. Again, ideally,\nthe new FBConnect module gets put in place which also includes new\npermissions and proper resposes to their new API. The current REST\nAPI is being deprecated.

{html}", "updateAuthor": { "name": "jesush.christ", "key": "jesush.christ", "displayName": "Jesus H. Christ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:42.000+0000", "updated": "2011-04-15T03:29:42.000+0000" }, { "id": "129426", "author": { "name": "anthonyroldan", "key": "anthonyroldan", "displayName": "Anthony Roldan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Having this broken also affects\nTitanium.Facebook.requestPermission, and causes it to not pop up a\ndialog if a user previously declined it.

\n

Jesus H. Christ's patch above fixes that too, though! Thanks,\nJesus.

{html}", "updateAuthor": { "name": "anthonyroldan", "key": "anthonyroldan", "displayName": "Anthony Roldan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:29:42.000+0000", "updated": "2011-04-15T03:29:42.000+0000" }, { "id": "169331", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Researching. By the way, isLoggedIn is not and was never a valid function on iOS. Use the property Titanium.Facebook.loggedIn as shown in Kitchen Sink. Similarly, there is no hasPermission, only permissions.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-10-14T16:30:56.000+0000", "updated": "2011-10-14T16:42:30.000+0000" }, { "id": "394563", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Fixed with Ti.Facebook 5.0.0 and later.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-27T12:56:11.000+0000", "updated": "2016-08-27T12:56:11.000+0000" }, { "id": "413710", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-20T16:59:32.000+0000", "updated": "2017-03-20T16:59:32.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }