Simulator crashes

My app compiles and runs perfectly for Android (on a Windows machine). But when running it on a mac, it crashes when receiving data from the network.

I send a request over http,

requestID = network.request(data, "GET", networkListener)

My networkListener looks like this,

local function networkListener( event ) if ( event.isError ) then native.showAlert("GEOREG", "Nettverksfeil, er dataforbindelse aktivert?", {"OK"}) else native.showAlert("GEOREG", event.response, {"OK"}) end network.cancel(requestID) end

It seems like something in networkListener causes the crash. Can anybody help me out on this?

This is the “crook”,

network.cancel(requestID)

Dunno if it’s necessary or not, but removing it cured the crash.

Yea, you shouldn’t cancel an event from its call back listener. You should wrap the call in a timer call:

timer.performWithDelay(10, function() network.cancel( requestID ); end)

Rob

This is the “crook”,

network.cancel(requestID)

Dunno if it’s necessary or not, but removing it cured the crash.

Yea, you shouldn’t cancel an event from its call back listener. You should wrap the call in a timer call:

timer.performWithDelay(10, function() network.cancel( requestID ); end)

Rob