Hi,
I'm trying to add a route to a map, on iOS7, using the addRoute function, but the application always crashes (Invalid type passed to a function at index.js).
I'm using Titanium SDK 3.2, using the iOS 7 Simulator on OSX Mavericks (Titanium Studio 3.2).
The project uses Alloy... the view file (index.xml) is quite simple:
<Alloy> <Window id="mainWindow" /> </Alloy>And the controller file is:
var MapModule = require('ti.map'); var testPoints = [ {latitude:38.713794262212076, longitude:-9.13338303565979}, {latitude:38.763495, longitude:-9.093763}, {latitude:38.71371054721669, longitude:-9.160258769989014}, {latitude:38.69162310730725, longitude:-9.215952157974243}, {latitude:38.7099432709518, longitude:-9.132546186447144}, {latitude:38.71203413379506, longitude:-9.140643775463104}, ]; var mySpecialRoute = ({ name: 'personal route', points: testPoints, color: 'red', width : 3 }); var mapview = MapModule.createView({ animate:true, mapType: MapModule.NORMAL_TYPE, regionFit: true, userLocation: true, }); $.mainWindow.add(mapview); mapview.addRoute(mySpecialRoute); $.mainWindow.open();The output of the error on the console is:
[ERROR] : Script Error { [ERROR] : backtrace = "#0 () at :0"; [ERROR] : line = 54; [ERROR] : message = "Invalid type passed to function"; [ERROR] : nativeLocation = "-[TiMapViewProxy addRoute:] (TiMapViewProxy.m:364)"; [ERROR] : nativeReason = "expected: TiMapRouteProxy, was: Object"; [ERROR] : sourceId = 323619520; [ERROR] : sourceURL = "file:///Volumes/UserData/carlosserrao/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/6B21A7E6-1636-473E-9F45-33A70158A0CE/hugacity.app/alloy/controllers/routemap.js"; [ERROR] : }I have searched over the Internet for a solution, but I have tested several solutions and no one seemed to have worked. I don't have any clues on how to solve it.
Can someone help, please?
Thanks in advance!!!