{
"id": "154198",
"key": "TIMOB-20217",
"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": "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": "2016-02-02T08:52:52.000+0000",
"created": "2016-01-09T01:36:09.000+0000",
"priority": {
"name": "Critical",
"id": "1"
},
"labels": [
"qe-5.2.0"
],
"versions": [
{
"id": "17532",
"name": "Release 5.1.1",
"archived": false,
"released": true,
"releaseDate": "2015-11-24"
}
],
"issuelinks": [
{
"id": "50250",
"type": {
"id": "10002",
"name": "Duplicate",
"inward": "is duplicated by",
"outward": "duplicates"
},
"inwardIssue": {
"id": "153233",
"key": "TIMOB-20002",
"fields": {
"summary": "iOS: Ti.Geolocation.requestLocationPermissions is not always called?",
"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": "High",
"id": "2"
},
"issuetype": {
"id": "1",
"description": "A problem which impairs or prevents the functions of the product.",
"name": "Bug",
"subtask": false
}
}
}
}
],
"assignee": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"updated": "2016-02-02T22:20:40.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": "h6.Issue Description \r\nGeolocation popup permission is not triggered by Ti.Geolocation.hasGeolocatinPermission()\r\nTi.Geolocation.hasGeolocatinPermission() does not work on iOS 7. It returns true before permission has been determined. Once it is determined it does not return the right value.\r\nTi.Geolocation.requestLocationPermissions() never calls the callback on iOS 7.\r\n\r\nh6.TestCase\r\n# Create a new Alloy default Application\r\n# Open views/index.xml\r\n# Replace the inside with the next code:\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n# Open controllers/index.js\r\n# Replace the inside with the next code:\r\n{code}\r\n$.win.open();\r\n\r\nfunction checkPermission(){\r\n\tif(Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE)){\r\n\t\tTi.API.info(\"APP HAS PERMISSION\");\t\r\n\t}else{\r\n\t\tTi.API.info(\"APP DOES NOT HAVE PERMISSION\");\r\n\t\trequestPermission();\r\n\t}\r\n}\r\n\r\nfunction requestPermission(){\r\n\tTi.API.info(\"REQUESTING PERMISSION\");\r\n\tTi.Geolocation.requestLocationPermissions(Titanium.Geolocation.AUTHORIZATION_WHEN_IN_USE,function(e){\r\n\t\tTi.API.info(\"INSIDE CALLBACK\");\r\n\t\tif(e.success){\r\n\t\t\tTi.API.info(\"PERMISSION GRANTED\");\r\n\t\t}else{\r\n\t\t\tTi.API.info(\"PERMISSION DENIED\");\r\n\t\t}\r\n\t});\r\n}\r\n\r\nfunction checkRequestPermission(){\r\n\tcheckPermission(requestPermission);\r\n}\r\n\r\nfunction getCurrentPosition(successHandler,errorHandler){\r\n\tTi.Geolocation.getCurrentPosition(function(result){\r\n\t\tif (result.error) {\r\n\t\t\tTi.API.info(\"GetCurrentPosition Error\");\r\n\t\t}else{\r\n\t\t\tTi.API.info(\"GetCurrentPosition returned\" + JSON.stringify(result));\r\n\t\t}\r\n\t});\r\n}\r\n{code}\r\n#open the tiapp.xml file and add the next lines inside ios/plist/dict\r\n{code}\r\n NSLocationWhenInUseUsageDescription\r\n Testing Location in use \r\n{code}\r\n# Run\r\n\r\nh6.Steps to Reproduce\r\n\r\n# Press \"Check Location Permission\" button which calls Ti.Geolocation.hasLocationPermissions(). It should return true and you should see \"APP HAS PERMISSION\" output. \r\n# Press \"Request Geolocation Permission\" which calls Ti.Geolocation.requestLocationPermissions() You should see \"REQUESTING PERMISSION\" in your output.\r\n# Third button calls Ti.Geolocation.getCurrentPosition() to get users current position which is what triggers geolocation permission popup to show. If you grant permission in the popup then press \"Check Location Permission\" button again and you should see \"APP DOES NOT HAVE PERMISSION\" followed by \"REQUESTING PERMISSION\". This also happens if you refuse permission. ",
"attachment": [],
"flagged": false,
"summary": "iOS: Ti.Geolocation.hasGeolocationPermission() and Ti.Geolocation.getCurrentPosition() are not working on IOS 7",
"creator": {
"name": "rramirez",
"key": "rramirez",
"displayName": " Ricardo Ramirez",
"active": true,
"timeZone": "America/Los_Angeles"
},
"subtasks": [],
"reporter": {
"name": "rramirez",
"key": "rramirez",
"displayName": " Ricardo Ramirez",
"active": true,
"timeZone": "America/Los_Angeles"
},
"environment": "Xcode 7.2\r\niOS 7\r\nSDK 5.1.1GA",
"closedSprints": [
{
"id": 580,
"state": "closed",
"name": "2016 Sprint 3 SDK",
"startDate": "2016-01-30T01:31:48.991Z",
"endDate": "2016-02-13T01:31:00.000Z",
"completeDate": "2016-02-15T05:32:40.725Z",
"originBoardId": 114
}
],
"comment": {
"comments": [
{
"id": "374148",
"author": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"updateAuthor": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"created": "2016-01-11T03:53:47.000+0000",
"updated": "2016-01-11T03:53:47.000+0000"
},
{
"id": "374642",
"author": {
"name": "rramirez",
"key": "rramirez",
"displayName": " Ricardo Ramirez",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "This is not working using iOS 7",
"updateAuthor": {
"name": "rramirez",
"key": "rramirez",
"displayName": " Ricardo Ramirez",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2016-01-15T02:24:39.000+0000",
"updated": "2016-01-15T02:24:39.000+0000"
},
{
"id": "374649",
"author": {
"name": "cng",
"key": "cng",
"displayName": "Chee Kiat Ng",
"active": false,
"timeZone": "America/Los_Angeles"
},
"updateAuthor": {
"name": "cng",
"key": "cng",
"displayName": "Chee Kiat Ng",
"active": false,
"timeZone": "America/Los_Angeles"
},
"created": "2016-01-15T04:54:52.000+0000",
"updated": "2016-01-15T04:54:52.000+0000"
},
{
"id": "374652",
"author": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"body": "[~cng] This has nothing to do with TIMOB-20165. \r\n\r\n[~rramirez] [~egomez] \r\nIn iOS7 User cannot request permission explicitly (like in iOS 8). System automatically presents location permission alert when we try to call {{Ti.Geolocation.getCurrentPosition()}} or geofencing. This should be updated in our docs. \r\n\r\nSecondly {{hasLocationPermissions}} has a regression issue which is caused because it always operates in iOS 8 mode. This should be fixed. ",
"updateAuthor": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"created": "2016-01-15T06:27:40.000+0000",
"updated": "2016-01-15T06:28:10.000+0000"
},
{
"id": "374803",
"author": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"body": "PR https://github.com/appcelerator/titanium_mobile/pull/7639\r\n\r\nChanges for iOS 7:\r\n1. Console warning when using {{Ti.Geolocation.requestLocationPermissions}}\r\n2. Correctly returns value of {{Ti.Geolocation.hasLocationPermissions}}\r\n3. Updated docs accordingly. \r\n\r\nAlternatively can use the following app.js for testing\r\n\r\n{code:javascript}\r\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\n// create base UI tab and root window\r\n//\r\nvar win = Titanium.UI.createWindow({className:'win1'});\r\n\r\nvar reqPerm = Titanium.UI.createButton({title: \"Request Permission\", top: 50});\r\nreqPerm.addEventListener('click', function(e) {\r\n checkPermission();\r\n requestPermission();\r\n});\r\n\r\nvar reqLoc = Titanium.UI.createButton({title: \"Request Location\", top: 150});\r\nreqLoc.addEventListener('click', function(e) {\r\n checkPermission();\r\n getCurrentPosition();\r\n});\r\n\r\nwin.add(reqPerm);\r\nwin.add(reqLoc);\r\n\r\nfunction checkPermission(){\r\n if(Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE)){\r\n Ti.API.info(\"APP HAS PERMISSION\"); \r\n }else{\r\n Ti.API.info(\"APP DOES NOT HAVE PERMISSION\");\r\n }\r\n}\r\n \r\nfunction requestPermission(){\r\n Ti.API.info(\"REQUESTING PERMISSION\");\r\n Ti.Geolocation.requestLocationPermissions(Titanium.Geolocation.AUTHORIZATION_WHEN_IN_USE,function(e){\r\n Ti.API.info(\"INSIDE CALLBACK\");\r\n if(e.success){\r\n Ti.API.info(\"PERMISSION GRANTED\");\r\n }else{\r\n Ti.API.info(\"PERMISSION DENIED\");\r\n }\r\n });\r\n}\r\n \r\nfunction checkRequestPermission(){\r\n checkPermission(requestPermission);\r\n}\r\n \r\nfunction getCurrentPosition(successHandler,errorHandler){\r\n Ti.API.info(\"REQUESTING LOCATION\");\r\n Ti.Geolocation.getCurrentPosition(function(result){\r\n if (result.error) {\r\n Ti.API.info(\"GetCurrentPosition Error\");\r\n }else{\r\n Ti.API.info(\"-GetCurrentPosition returned\" + JSON.stringify(result));\r\n }\r\n });\r\n}\r\n\r\nwin.open();\r\n{code}",
"updateAuthor": {
"name": "apetkov",
"key": "apetkov",
"displayName": "Angel Petkov",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2016-01-19T04:16:07.000+0000",
"updated": "2016-01-20T23:46:18.000+0000"
},
{
"id": "375154",
"author": {
"name": "nradaev",
"key": "nradaev",
"displayName": "Nikita Radaev",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "I disagree that this is the right fix guys. The whole point of using Appcelerator is to abstract away all (or most ) platform-specific conditionals. Besides, same functionality is backwards compatible on Android. I dont understand why it is not possible to do same thing on IOS. SDK should be taking care of addressing this issue and not the users.",
"updateAuthor": {
"name": "nradaev",
"key": "nradaev",
"displayName": "Nikita Radaev",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2016-01-22T14:20:04.000+0000",
"updated": "2016-01-22T14:20:04.000+0000"
},
{
"id": "375155",
"author": {
"name": "CollinPrice",
"key": "collinprice",
"displayName": "Collin Price",
"active": true,
"timeZone": "America/Toronto"
},
"body": "So instead of making the function backwards compatible, like it is on Android, my code has to check if the user is running iOS and is on iOS 7? I thought the major advantage of using Titanium is that I don't have to think about what platform/OS version the user is running.\r\n\r\n@ssombhatla Sure iOS 7 doesn't request location permission the same as iOS 8+ but why can't the requestLocationPermissions method do whatever it needs to do to prompt the user on iOS 7?",
"updateAuthor": {
"name": "CollinPrice",
"key": "collinprice",
"displayName": "Collin Price",
"active": true,
"timeZone": "America/Toronto"
},
"created": "2016-01-22T14:30:10.000+0000",
"updated": "2016-01-22T14:30:10.000+0000"
},
{
"id": "375270",
"author": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"body": "[~CollinPrice], [~nradaev] point taken. ",
"updateAuthor": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"created": "2016-01-26T05:40:04.000+0000",
"updated": "2016-01-26T05:40:04.000+0000"
},
{
"id": "375271",
"author": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"body": "Reopening to address community comments. ",
"updateAuthor": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"created": "2016-01-26T05:40:25.000+0000",
"updated": "2016-01-26T05:40:25.000+0000"
},
{
"id": "375272",
"author": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"body": "PR: https://github.com/appcelerator/titanium_mobile/pull/7642\r\nUse the same app.js for testing. \r\n\r\nReworked to make requestLocationPermissions in iOS7 to behave like iOS8+, where permission alert is presented and continued based on User selection.",
"updateAuthor": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"created": "2016-01-26T05:41:06.000+0000",
"updated": "2016-01-26T05:41:52.000+0000"
},
{
"id": "375303",
"author": {
"name": "apetkov",
"key": "apetkov",
"displayName": "Angel Petkov",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "FT and CR approved, thanks Srikanth!",
"updateAuthor": {
"name": "apetkov",
"key": "apetkov",
"displayName": "Angel Petkov",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2016-01-26T18:22:41.000+0000",
"updated": "2016-01-26T18:22:41.000+0000"
},
{
"id": "375458",
"author": {
"name": "nradaev",
"key": "nradaev",
"displayName": "Nikita Radaev",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "Srikanth Sombhatla, yes the issue with Ti.Geolocation.hasLocationPermissions is fixed and it now works as promised, however Ti.Geolocation.requestLocationPermissions() still does not work properly on IOS 7. There is simply no callback being thrown after user GRANTS or DENIES permission untill the app is reloaded. Here is a code snippet to recreate the issue:if(!Ti.Geolocation.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE)){\r\n\t\r\n\tTi.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE, function(resp){\r\n\t\r\n\t\tTi.API.info(\"Callback returned = \" + JSON.stringify(resp));\r\n\t\t\r\n\t\tif(resp.success){\r\n\t\t\tTi.API.info(\"Geolocation permission GRANTED\");\r\n\t\t}else{\r\n\t\t\tTi.API.info(\"Permision denied\");\t\t\t\r\n\t\t}\r\n\t\t\r\n\t});\r\n}else{\r\n\tTi.API.info(\"This device has geolocation permissions\");\r\n} ",
"updateAuthor": {
"name": "nradaev",
"key": "nradaev",
"displayName": "Nikita Radaev",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2016-01-28T21:30:54.000+0000",
"updated": "2016-01-28T21:30:54.000+0000"
},
{
"id": "375543",
"author": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"body": "PR https://github.com/appcelerator/titanium_mobile/pull/7656\r\n\r\nThis requires that creation of location delegate and subsequent permission alert are presented on main thread. This is because by default JS runs on its own thread enabled by TI_USE_KROLL_THREAD.",
"updateAuthor": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"created": "2016-01-31T05:19:53.000+0000",
"updated": "2016-01-31T05:19:53.000+0000"
},
{
"id": "375709",
"author": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"body": "5_2_X PR: https://github.com/appcelerator/titanium_mobile/pull/7667",
"updateAuthor": {
"name": "ssombhatla",
"key": "ssombhatla",
"displayName": "Srikanth Sombhatla",
"active": false,
"timeZone": "Asia/Singapore"
},
"created": "2016-02-02T08:31:05.000+0000",
"updated": "2016-02-02T08:31:05.000+0000"
},
{
"id": "375713",
"author": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"body": "Approved, thanks!",
"updateAuthor": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"created": "2016-02-02T08:52:44.000+0000",
"updated": "2016-02-02T08:52:44.000+0000"
},
{
"id": "375754",
"author": {
"name": "htbryant",
"key": "htbryant",
"displayName": "Harry Bryant",
"active": true,
"timeZone": "Europe/London"
},
"body": "Verified as fixed, using an iOS7 device {{Ti.Geolocation.requestLocationPermissions}} & {{Ti.Geolocation.hasLocationPermissions}} now returns correct value, & {{Ti.Geolocation.getCurrentPosition()}} now correctly returns the correct position.\r\n\r\nTested on:\r\niPhone 4S (7.1.2) & iPhone 6S (9.2) Devices\r\nMac OSX El Capitan 10.11 (15A284)\r\nAppc Studio: 4.5.0.201601262138\r\nTi SDK: 5.2.0.v20160202103508\r\nAppc NPM: 4.2.3-1\r\nApp CLI: 5.2.0-239\r\nXcode 7.2\r\nNode v4.2.3\r\n\r\n*Closing Ticket.*\r\n",
"updateAuthor": {
"name": "htbryant",
"key": "htbryant",
"displayName": "Harry Bryant",
"active": true,
"timeZone": "Europe/London"
},
"created": "2016-02-02T19:55:17.000+0000",
"updated": "2016-02-02T19:55:41.000+0000"
}
],
"maxResults": 20,
"total": 20,
"startAt": 0
}
}
}