{ "id": "174143", "key": "AC-6369", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-12-30T09:20:04.000+0000", "created": "2019-09-17T16:20:40.000+0000", "labels": [ "8.1.0.GA", "8.1.1.GA", "geolocation" ], "versions": [], "issuelinks": [], "assignee": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "updated": "2020-01-14T18:10:04.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "When using {code}Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE, event => Ti.API.info(event)){code} the given callback is never fired on Ti SDK 8.1.0.GA and 8.1.1.GA. The same code on Ti SDK 8.0.0.GA works as expected.", "attachment": [], "flagged": false, "summary": "iOS: Ti.Geolocation.requestLocationPermissions doesn't fire given callback on 8.1.0+", "creator": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Ti SDK 8.1.1.GA\r\nMac OSX 10.14.6\r\nAppc cli 7.1.1", "comment": { "comments": [ { "id": "451650", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It's working fine for me with 8.1.0.GA. Is there any particular iOS version?\r\nI assume you have added key \"NSLocationWhenInUseUsageDescription\" in tiapp.xml.", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-09-26T23:54:45.000+0000", "updated": "2019-09-26T23:54:45.000+0000" }, { "id": "452140", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~Andrea.Vitale], Can you please follow up here on Vijay's comment? Let us know the status of your issue. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-10-19T23:20:56.000+0000", "updated": "2019-10-19T23:20:56.000+0000" }, { "id": "453326", "author": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi [~Andrea.Vitale], \r\nWe have tested this issue in real device and failed to reproduce this issue. Ti.Geolocation.requestLocationPermissions has fired and returned the callback function.\r\nMake sure in your tiapp.xml ios / plist / dict section you have added these below:\r\n{code}\r\nNSLocationWhenInUseUsageDescription\r\nCan we access your location when using the app\r\nNSLocationAlwaysAndWhenInUseUsageDescription\r\n Can we use geolocation?\r\n{code}\r\n\r\nI've tried these below code in app/controllers/index.js file: \r\n{code}\r\nfunction doClick(e) {\r\n\r\n\tvar hasLocationPermission = Ti.Geolocation\r\n\t\t\t.hasLocationPermissions(Ti.Geolocation.AUTHORIZATION_WHEN_IN_USE);\r\n\tif (!hasLocationPermission) {\r\n\t\tTi.Geolocation.requestLocationPermissions(\r\n\t\t\t\tTi.Geolocation.AUTHORIZATION_WHEN_IN_USE, function(e) {\r\n\t\t\t\t\tif (e.success) {\r\n\t\t\t\t\t\tgetLocation();\r\n\t\t\t\t\t\t// permission granted\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// permission refused\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t}else{\r\n\t\tgetLocation();\r\n\t}\r\n\r\n\tfunction getLocation(e) {\r\n\t\tTitanium.Geolocation.preferredProvider = \"gps\";\r\n\t\tTitanium.Geolocation.purpose = \"user coordinates\";\r\n\t\tTitanium.Geolocation.distanceFilter = 10;\r\n\r\n\t\tTitanium.Geolocation.getCurrentPosition(function(e) {\r\n\t\t\tif (!e.success || e.error) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar longitude = e.coords.longitude;\r\n\t\t\tvar latitude = e.coords.latitude;\r\n\t\t\tvar altitude = e.coords.altitude;\r\n\t\t\tvar heading = e.coords.heading;\r\n\t\t\tvar accuracy = e.coords.accuracy;\r\n\t\t\tvar speed = e.coords.speed;\r\n\t\t\tvar timestamp = e.coords.timestamp;\r\n\t\t\tvar altitudeAccuracy = e.coords.altitudeAccuracy;\r\n\t\t\tTitanium.Geolocation.reverseGeocoder(latitude, longitude, function(\r\n\t\t\t\t\tevt) {\r\n\t\t\t\tif (evt.success) {\r\n\t\t\t\t\tvar places = evt.places;\r\n\t\t\t\t\talert('Your Current Location is : ' + places[0].address\r\n\t\t\t\t\t\t\t+ '\\n Latitude:' + latitude + '\\nLongitude : '\r\n\t\t\t\t\t\t\t+ longitude);\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tTi.API.info(\"Reverse geocoding error\");\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n}\r\n\r\n$.index.open();\r\n{code}\r\n\r\nEnvironment details: \r\n{code}\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.14.6\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\n\r\nNode.js\r\n Node.js Version = 8.9.4\r\n npm Version = 6.5.0\r\n\r\nTitanium CLI\r\n CLI Version = 5.2.2\r\n\r\nTitanium SDK\r\n SDK Version = 8.3.0.GA\r\n Target Platform = iphone 5S\r\n[INFO] Building using iOS SDK: 13.2\r\n{code}", "updateAuthor": { "name": "rislam", "key": "rislam", "displayName": "Riduanul Islam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-27T20:20:50.000+0000", "updated": "2019-12-27T21:46:10.000+0000" }, { "id": "453701", "author": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "body": "Guys I have this inside my tiapp.xml\r\n\r\n{code:xml}\r\n NSLocationAlwaysAndWhenInUseUsageDescription\r\n Per proporti sempre la combinazione migliore tra prodotti e farmacie e per mostrarti le migliori offerte vicine a te, abbiamo bisogno di accedere alla tua posizione!\r\n NSLocationWhenInUseUsageDescription\r\n Per proporti sempre la combinazione migliore tra prodotti e farmacie e per mostrarti le migliori offerte vicine a te, abbiamo bisogno di accedere alla tua posizione!\r\n{code}\r\n\r\nand here is the permissions request function:\r\n\r\n\r\n{code:java}\r\n const defaultRequestOptions = {\r\n mode: AuthorizationTypes.IN_USE\r\n };\r\n\r\n const requestLocationPermissions = function(options = {}) {\r\n options = _.defaults(options, defaultRequestOptions);\r\n\r\n return new Promise((resolve, reject) => {\r\n if (Ti.Geolocation.hasLocationPermissions(options.mode)) {\r\n resolve();\r\n } else {\r\n Ti.Geolocation.requestLocationPermissions(options.mode, event => {\r\n Ti.API.info('Got response:', event);\r\n\r\n event.success\r\n ? resolve()\r\n : reject(_.pick(event, ['error', 'code']));\r\n });\r\n }\r\n });\r\n }\r\n{code}\r\n\r\nThis is in a REAL app and sometimes works and sometimes it doesn't. Log message \"Got response...\" isn't printed out and the promise isn't resolved or rejected.", "updateAuthor": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-01-14T18:10:04.000+0000", "updated": "2020-01-14T18:10:04.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }