[TIMOB-20046] Ti.Geolocation.getCurrentPosition returns success:true with no coords
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 5.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Fokke Zandbergen |
Assignee | Unknown |
Created | 2015-11-23T14:27:56.000+0000 |
Updated | 2018-11-29T13:38:02.000+0000 |
Description
For a new training app I did:
Ti.Geolocation.getCurrentPosition(function(e) {
console.debug('LOCATION: ' + JSON.stringify(e));
if (!e.success) {
return showError(e.error || 'Could not find your location');
}
getWeather(e.coords);
});
And of course in {tiapp.xml}}:
<key>NSLocationAlwaysUsageDescription</key>
<string>Get the weather for your location.</string>
But the response in Simulator was:
{
"success": true,
"code": 0,
"source": {},
"type": "location",
"error": "The operation couldn’t be completed. (kCLErrorDomain error 0.)"
}
I expected to get coords
of course, but in case of an error at least success:false
instead of true
.
*NOTE:* The [documentartion](https://appcelerator.github.io/appc-docs/latest/#!/api/LocationResults) only lists coords
and provider
(Android) and not success
and error
.
Someone with news? I have the same problem with android! Someone can help me?
[~otto.pic] what is the content of
getCurrentPosition()
? Is it justTi.Geolocation.getCurrentPosition(callback)
or a you subscribing to thelocation
event?Did you receive a location before? If you don't have a location you'll receive NULL. When I had a location outside my app (with a GPS test tool)
getCurrentPosition()
returns my last location. For moving coordingatsTi.Geolocation.addEventListener('location', location);
of course.I have found the problem but I haven't solution. If I install the app with wifi enabled and data and gps disabled there isn't way to get location enabling data and gps too. If I install the app with data and gps enabled all work fine. I don't understand very well what's append, but how can I get location from the best source wifi, data or gps?