Below is my sample code. The map loads fine, the parameters are passed that are referenced (from another window), and the pin is dropped. However, clicking on it on the device and the simulator causes the app to crash, and the error log doesnt provide anything helpful
var mapview = Titanium.Map.createView({ mapType: Titanium.Map.STANDARD_TYPE, region:{latitude:latitude, longitude:longitude, latitudeDelta:0.5, longitudeDelta:0.5}, animate:true, regionFit:true, userLocation:true }); win.add(mapview); for(x=0;x<1;x++) { var mySaved = Titanium.Map.createAnnotation({ latitude:win.lat, longitude:win.lon, title:win.winTitle, subtitle:win.location, myid:x, animate:true, rightButton: 'wheel.png', }); mapview.addAnnotation(mySaved); } mapview.addEventListener('click',function(evt) { // map event properties var annotation = evt.annotation; var title = evt.title; var clickSource = evt.clicksource; var endLat=evt.latitude; var endLon=evt.longitude; //alert(evt.annotation.latitude); // custom annotation attribute var myid = (evt.annotation)?evt.annotation.myid:-1; if (clickSource=="rightButton") { var url="http://maps.google.com/maps?saddr=" + latitude +"," + longitude + "&daddr="+endLat+ ","+ endLon; //var url="http://maps.google.com/maps?saddr=" + latitude +"," + longitude + "&daddr="+win.location; //alert(url); Ti.Platform.openURL(url); } });
1 Answer
Also, just to note, even if I take out EVERYTHING from the eventlistener and do a simple alert('test'); it freezes and crashes.
Your Answer
Think you can help? Login to answer this question!