Director & Maps

I’m working on implementing a map screen.
To do this I’m transitioning from a normal scene (with a PNG) background, to a new scene that is to display a map. The problem I’m having is that it crashes every time on the following code:

module(..., package.seeall)  
  
function new()  
 local myMap  
 local mainMenuGroup = display.newGroup()  
  
 mapLoad = function()  
  
 myMap = native.newMapView( 0, 0, display.contentWidth, display.contentHeight )  
 myMap.mapType = "normal" -- other mapType options are "satellite" or "hybrid"  
 myMap:setCenter( 37.331692, -122.030456 )  
 end  
  
 mapLoad()  

I’m seeing the following output in the terminal:

[code]

WARNING: Map views are not supported in the simulator. Please build for device.
Runtime error
…assenko/Desktop/corona/director class C/mainmenu.lua:10: attempt to index upvalue ‘myMap’ (a nil value)
stack traceback:
[C]: ?
…assenko/Desktop/corona/director class C/mainmenu.lua:10: in function ‘mapLoad’
…assenko/Desktop/corona/director class C/mainmenu.lua:14: in function ‘new’
…assenko/Desktop/corona/director class C/director.lua:118: in function ‘loadScene’
…assenko/Desktop/corona/director class C/director.lua:413: in function ‘changeScene’
…senko/Desktop/corona/director class C/logoscreen.lua:31: in function ‘onEvent’
…peterdassenko/Desktop/corona/director class C/ui.lua:88: in function <…peterdassenko class c>
?: in function <?:214>
[/code]

I feel like it’s something obvious - but I haven’t been able to get it… Any insights are much appreciated. Thanks! [import]uid: 30914 topic_id: 8112 reply_id: 308112[/import] </…peterdassenko>

Hi,

It says in the API reference that:

“Map objects like other native objects don’t work in groups and are always displayed on top of regular Display Objects (vector, images, and text).”

Maybe that’s where the error comes from?

Ch. [import]uid: 4958 topic_id: 8112 reply_id: 29304[/import]