simulator differs from device

Everything with the storyboard and scenes are running fine with no errors in the simulator, but on the iOS device I’m getting a runtime error.  

Jan 23 12:47:11 iPhone APP[9276] <Warning>: Runtime error

    ?:0: attempt to index upvalue ‘?’ (a nil value)

    stack traceback:

        [C]: ?

        ?: in function <?:320>

        ?: in function ‘dispatchEvent’

        ?: in function ‘gotoScene’

        ?: in function ‘_onPress’

        ?: in function ‘_setSelected’

        ?: in function <?:232>

        ?: in function <?:218>

Are there any tools that I could use to try and track down the offending nil?  

I’ll start systematically removing everything from the scene until it works…

this is the bit of code that is causing the problem.

&nbsp;local escape\_btn = widget.newButton &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;id = 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;left = 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;top = 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;defaultFile="assets/escapeX.png", &nbsp; &nbsp; &nbsp; &nbsp; onEvent = escapeListener &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;escape\_btn.anchorX, escape\_btn.anchorY = 0, 0 &nbsp; &nbsp; &nbsp; &nbsp;escape\_btn.x = 460 &nbsp; &nbsp; &nbsp; &nbsp;escape\_btn.y = 186 &nbsp;

when it’s in the scene, simulator works well, device crashes.  Taken out, everybody is happy.

Are you sure the filenames are exactly the same case (lower/uppercase) letters? The filenames have to be identical on devices, the simulator doesn’t mind if they are different however.

I double checked the case, all was the same.  

To confuse myself further, I saved the PNG files as JPGs and now it’s happy again.  

Why it didn’t like these particular png files and not all the others ones I’m still using, who knows!  

Glad to hear you got it working :slight_smile:

this is the bit of code that is causing the problem.

&nbsp;local escape\_btn = widget.newButton &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;id = 1, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;left = 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;top = 0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;defaultFile="assets/escapeX.png", &nbsp; &nbsp; &nbsp; &nbsp; onEvent = escapeListener &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;escape\_btn.anchorX, escape\_btn.anchorY = 0, 0 &nbsp; &nbsp; &nbsp; &nbsp;escape\_btn.x = 460 &nbsp; &nbsp; &nbsp; &nbsp;escape\_btn.y = 186 &nbsp;

when it’s in the scene, simulator works well, device crashes.  Taken out, everybody is happy.

Are you sure the filenames are exactly the same case (lower/uppercase) letters? The filenames have to be identical on devices, the simulator doesn’t mind if they are different however.

I double checked the case, all was the same.  

To confuse myself further, I saved the PNG files as JPGs and now it’s happy again.  

Why it didn’t like these particular png files and not all the others ones I’m still using, who knows!  

Glad to hear you got it working :slight_smile: