Current Location does not work with MapModule

1

Using Appcelerator, starting a new project and need to place my current location on the map, but I can not place it. I can only put a fixed point. Here are my codes below:

/Resources/ui/controller/geolocation.js:

var points = [];
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;

Titanium.Geolocation.distanceFilter = 10;

Titanium.Geolocation.getCurrentPosition(function(e){
activityScreen.show();

if (e.error)
{
    alert('HFL cannot get your current location');
    activityScreen.hide();
    return;
}

win.longitude   = e.coords.longitude;
win.latitude    = e.coords.latitude;

win.latitude    = -23.4438148;
win.longitude   = -46.5335198;

if(typeof(vc) != "undefined")
{
    vc.latitude     = win.latitude; 
    vc.longitude    = win.longitude;

    mapview.region = {
        latitude:win.latitude, longitude: win.longitude,
        latitudeDelta:0.1, longitudeDelta:0.1
    };

}

activityScreen.hide();

});

/Resources/ui/view/iphone/maps/maps.js:

Ti.include("/ui/controller/geolocation.js");
var MapModule = require('ti.map');


var vc = MapModule.createAnnotation({
 latitude: win.latitude,
 longitude: win.longitude,
 title: 'Você está aqui',
 subtitle: 'São Paulo, SP',
 pincolor: MapModule.ANNOTATION_GREEN,
 image:"/ui/images/zapsacmini.png",
});

var walmart = MapModule.createAnnotation({
 latitude: -23.474891,
 longitude: -46.526756,
 title: 'Loja',
 subtitle: 'Guarulhos, SP',
 pincolor: MapModule.ANNOTATION_RED,
 image:"/ui/images/loja.png",
}); 


var mapview = MapModule.createView({
top:0,
height: "80%",
mapType: MapModule.NORMAL_TYPE,
region: {latitude: win.latitude, longitude: win.longitude, latitudeDelta: 0.001, longitudeDelta: 0.001},
annotations: [vc,walmart],
animate:true,
});

mapview.visible = false;

win.add(mapview);

When I test my application, only the fixed point (Store) appears. Only my Current Location does not appear!

Remembering that I've already put the key NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription in my tiapp.xml

Does anyone know what the problem is or is the correct code?

    
asked by anonymous 24.11.2015 / 22:54

0 answers