App runs in Simulator and xCode iOS Simulator but fails on hardware?

The app I have been working on porting to decided on if I am going to buy corona has run into a snag tonight.
Between the last time I made a device build and the current one something has caused several of my buttons to be drawn in the upper left of the device. They are mostly off screen and do not respond to touch. This only happens on my iphone, on the corona simulator and iOS simulator it works fine.

Also I have a keyboard come up at app launch that worked before and now it does not.

Below are the logs out of xcode that seemed a little out of place

Dec 17 00:38:36 unknown com.apple.SpringBoard[15] : wait_fences: failed to receive reply: 10004003
Dec 17 00:38:36 unknown UIKitApplication:com.bradherman.anccalc[0xee7a][144] : Lua Runtime Error: lua_pcall failed with status: 2, error message is: ?:0: attempt to index a nil value
Dec 17 00:38:36 unknown ANCCalc[144] : Applications are expected to have a root view controller at the end of application launch

Before I start going chunk by chunk in my code trying to find this issue has anyone seen it before?
Things I changed since last build:
added toggle.lua
added several png files
added a few EventListener
added a few global and local functions
moved some buttons around in screen layout

I searched my code looking for “lua_pcall” and it’s not in my files.

Running 704 public [import]uid: 110373 topic_id: 19273 reply_id: 319273[/import]

You’d want to go back to your last version (assuming you save your project and backup regularly) then step forward a little bit at a time to try and isolate what code is causing the issue.

When is it crashing on the device? At start up or ?

Peach :slight_smile: [import]uid: 52491 topic_id: 19273 reply_id: 74357[/import]

lua_pcall is called by the Corona SDK or the lua engine to call one of your lua function.

lua_pcall failed with status: 2, error message is: ?:0: attempt to index a nil value

This for sure has something to do with the scope of an object that this function is trying to access and the object is nil.

I would agree with Peach. Go back to a working version and be careful when modifying code and test often.

Hope this helps [import]uid: 69375 topic_id: 19273 reply_id: 74404[/import]

Kaveng:
Thanks for the detailed breakdown. Is this a common problem that things run in the simulator and the iOS simulator but fail on hardware?
There was about 3 hours of dev work between builds I tested on hardware. I have some backups but as I was tinkering I don’t have a full copy of the last working one. My bad. Do you guys use github? Whats the most common revision system used with corona? [import]uid: 110373 topic_id: 19273 reply_id: 74406[/import]

Fixed

Thank you for all the help posts.

I Found two issues, one was a function that I had commented out the debug print stantment for. It looks like a function that does nothing returns nil and that was probably the culprit. The other possibility was that when I compiled an iOS build from the simulator the terminal did point out that one of my png files was corrupt. The odd thing about that is that it showed up fine everywhere expect on hardware, so it was just corrupt enough to break further down the pipeline.

I have also installed the free App SourceTree from the app store to manage my source code and art files with Git. It’s nice and user friendly and now I can track my changes and revert :slight_smile:

[import]uid: 110373 topic_id: 19273 reply_id: 74454[/import]

Hey Brad,

Glad to hear you got it solved.

For your question, no, it isn’t very common at all that things work in the simulator and then fail on device; not if they are error free. Unfortunately though it does happen sometimes as you have just seen.

Peach :slight_smile: [import]uid: 52491 topic_id: 19273 reply_id: 74478[/import]