physics.start() crashing on device, not simulator

This is the first part of my app:

[lua]cpm = require ( “cpmlib” )
prnt(“Before almost anything…”)

local physics = require(“physics”)
prnt(“After requiring physics…”)

physics.start()
prnt(“After starting physics…”)[/lua]

The call to prnt() is not misspelled – if running on the simulator it does a print() but if running on a device it sends the message to an external server.

I’m not seeing that third prnt() message – and in the console of the device I’m seeing an error message that includes this:

Aug 12 01:51:08 unknown UIKitApplication:com.jawhjye.rolypolieshd[0xa3e5][31622] <notice>: Lua Runtime Error: lua_pcall failed with status: 2, error message is: ?:0: attempt to call field 'start' (a nil value)<br>

The cpm library has to be included first because it has that prnt() function, but there are no physics calls or anything like that in there.

This is an app that was put on the App Store probably a year ago and I was just trying to recompile with the latest build so it would work on the iPad 3. But I can’t get it going at all due to this problem.

I’m using Corona SDK 840.

Any ideas?

Jay

PS - It crashes the same way when I build for the Xcode iOS Simulator, too.
[import]uid: 9440 topic_id: 29765 reply_id: 329765[/import]

Okay, this is weird…

I stripped everything out of the app except the following:

[lua]local function prnt(msg)
local postURL = “http://requestb.in/1cp1ymd1
local function networkListener( event )
– nada because if not in sim won’t ever see it
end
local params = {}
params.body = msg
network.request( postURL, “POST”, networkListener, params)
end

local physics = require(“physics”)
prnt(“After requiring physics…”)

physics.start( false )
prnt(“After starting physics…”)

local function nada()
print(“done with it all…”)
end

timer.performWithDelay(5000, nada)[/lua]

…and that works. I get both messages on the server. The crash doesn’t happen.

However, when those same lines are at the beginning of the full app I get the crash at physics.start().

So I am confused. :frowning:

Jay
[import]uid: 9440 topic_id: 29765 reply_id: 119426[/import]

Six months later I get back to this project – and am again stonewalled by this thing.

Has anyone run into something like this? What would make an app built for device throw that error, but it isn’t seen in the simulator?

While it *could* be something later in my code doing that, this is happening at the very beginning of my main.lua – in fact, I moved the physics lines to the very beginning so physics.start() was at line 2 and it still crashes on device (and on iOS Simulator in Xcode).

Jay

[import]uid: 9440 topic_id: 29765 reply_id: 141894[/import]

Jay, have you tried stripping out parts of your main.lua to try and isolate this? And just a completely dumb question… you don’t have a physics.lua file in your project?

[import]uid: 199310 topic_id: 29765 reply_id: 141922[/import]

Noooooooooo!

Are you kidding me???

Apparently at some point I was playing with PhysicsEditor and it generated some Lua code for me to save – at which point I chose the very clever name, physics.lua.

Argh!

I feel slightly foolish.

But only slightly because unless Corona leaves out the Box2D library when it compiles, I should never be able to shoot myself in that foot.

Once again Rob comes to the rescue.

Jay
[import]uid: 9440 topic_id: 29765 reply_id: 141939[/import]

Six months later I get back to this project – and am again stonewalled by this thing.

Has anyone run into something like this? What would make an app built for device throw that error, but it isn’t seen in the simulator?

While it *could* be something later in my code doing that, this is happening at the very beginning of my main.lua – in fact, I moved the physics lines to the very beginning so physics.start() was at line 2 and it still crashes on device (and on iOS Simulator in Xcode).

Jay

[import]uid: 9440 topic_id: 29765 reply_id: 141894[/import]

Jay, have you tried stripping out parts of your main.lua to try and isolate this? And just a completely dumb question… you don’t have a physics.lua file in your project?

[import]uid: 199310 topic_id: 29765 reply_id: 141922[/import]

Noooooooooo!

Are you kidding me???

Apparently at some point I was playing with PhysicsEditor and it generated some Lua code for me to save – at which point I chose the very clever name, physics.lua.

Argh!

I feel slightly foolish.

But only slightly because unless Corona leaves out the Box2D library when it compiles, I should never be able to shoot myself in that foot.

Once again Rob comes to the rescue.

Jay
[import]uid: 9440 topic_id: 29765 reply_id: 141939[/import]