{ "id": "152606", "key": "TIMOB-19850", "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": "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" }, { "id": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-11-04T04:08:27.000+0000", "created": "2015-11-03T09:43:23.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "permissions" ], "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": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2015-11-20T23:27:31.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": "While working on the permissions sample app I ran into some irregularities:\r\n\r\n* The API reference for [hasLocationPermissions|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Geolocation-method-hasLocationPermissions] lists all {{AUTHORIZATION_*}} constants as possible values, while only {{AUTHORIZATION_ALWAYS}} and {{AUTHORIZATION_WHEN_IN_USE}} are valid.\r\n* The API reference for [requestLocationPermissions|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Geolocation-method-requestLocationPermissions] lists all {{AUTHORIZATION_*}} constants as possible values, while only {{AUTHORIZATION_ALWAYS}} and {{AUTHORIZATION_WHEN_IN_USE}} are valid.\r\n* The implementation of [requestLocationPermissions|https://github.com/appcelerator/titanium_mobile/blob/1607237763f9e490e41d98b8d711ac49eeb01043/iphone/Classes/GeolocationModule.m#L879-L884] seems to call the {{locationPermissionManager}} twice if the first statement is false:\r\n\r\n{code}\r\n if (currentPermissionLevel == kCLAuthorizationStatusAuthorizedWhenInUse) {\r\n NSLog(@\"[ERROR] cannot change already granted permission from AUTHORIZATION_WHEN_IN_USE to AUTHORIZATION_ALWAYS\");\r\n } else {\r\n [[self locationPermissionManager] requestAlwaysAuthorization];\r\n }\r\n [[self locationPermissionManager] requestAlwaysAuthorization];\r\n{code}\r\n\r\n* On Android {{Ti.Calendar.requestCalendarPermissions}}, {{Ti.Contacts.requestContactsPermissions}} and {{Ti.Media.requestCameraPermissions}} will call back with {{success:false}} if the required permission is missing in {{tiapp.xml}} but on iOS {{Ti.Geolocation.requestLocationPermissions}} will not call back at all when the required {{NSLocation*UsageDescription}} key is missing in {{tiapp.xml}}. It should call back with {{success:false}} as well.\r\n* If you don't allow permission when asked by {{Ti.Calendar.requestCalendarPermissions}} or {{Ti.Contacts.requestContactsPermissions}} it will call back with {{success:false}} but {{Ti.Geolocation.requestLocationPermissions}} does not call back at all.\r\n* For both {{hasLocationPermissions}} and {{requestLocationPermissions}} wouldn't the expected behaviour be that if {{AUTHORIZATION_ALWAYS}} was granted then {{AUTHORIZATION_WHEN_IN_USE}} would be seen as granted as well since always > when in use?", "attachment": [], "flagged": false, "summary": "iOS: Permissions (Geolocation) Bugs in implementation & documentation", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "SDK 5.1.0.v20151028190028", "closedSprints": [ { "id": 517, "state": "closed", "name": "2015 Sprint 22 SDK", "startDate": "2015-10-24T00:30:42.059Z", "endDate": "2015-11-07T01:30:00.000Z", "completeDate": "2015-11-09T02:37:29.441Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "368818", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Ti 5.1.0 sample app for testing:\r\nhttps://github.com/appcelerator-developer-relations/appc-sample-ti510/blob/master/app/controllers/permissions.js", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-11-03T12:32:03.000+0000", "updated": "2015-11-03T12:32:03.000+0000" }, { "id": "368921", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "All changes implemented, except of the \"auto grant {{when-in-use}}, if {{always}} was granted before\" since that is no bug but a question on how to check the permissions. In my opinion, a user requests either {{when-in-use}} or {{always}} on one use case, not both. And if so, the users can now check against this, but we don't do it automatically.\r\n\r\nPR master: https://github.com/appcelerator/titanium_mobile/pull/7395\r\nPR 5_1_X: https://github.com/appcelerator/titanium_mobile/pull/7396 ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-04T02:41:41.000+0000", "updated": "2015-11-04T02:41:41.000+0000" }, { "id": "368927", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "CR and FT passed. PRs merged.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-04T04:08:12.000+0000", "updated": "2015-11-04T04:08:12.000+0000" }, { "id": "369232", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, using the permissions sample app, tested that permissions were correctly requested and granted. Verified that this was reflected under Settings > Privacy. Setting the permissions to deny the app will cause the app to request permission access again. \r\n\r\nTested on:\r\niPhone 6S+ iOS 9.1 Device & iPhone 6 iOS 9.1 Sim\r\nMac OSX El Capitan 10.11 (15A284) \r\nTi SDK: 5.1.0.v20151104190037 \r\nAppc NPM: 4.2.1 \r\nAppc CLI: 5.1.0-43\r\nTi CLI: 5.0.4 \r\nAlloy: 1.7.23 \r\nXcode 7.1(7B91b) \r\nNode v0.12.7 \r\nproduction\r\n\r\nClosing ticket.", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2015-11-06T23:20:34.000+0000", "updated": "2015-11-06T23:20:34.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }