I am hacking around with Corona SDK. I got the following error when switching scenes to one that already existed. (I was implementing a “Go Back” button.)
Corona Simulator[5653] <Error>: CGImageCreate: invalid image size: 0 x 0. Corona Simulator[5653] <Error>: CGContextDrawImage: invalid context 0x0 Corona Simulator[5653] <Error>: CGBitmapContextCreateImage: invalid context 0x0 ImageIO: <ERROR> CGImageDestinationAddImage image parameter is nil ImageIO: <ERROR> CGImageDestinationFinalize image destination does not have enough images
The symptom was that a button from a previous scene wasn’t removed from the scene when I called storyboard.gotoScene
. The problem was that I wasn’t adding the button to the scene view display object as a child. This particular error was hidden from me because it seems you do not need to call scene.view:insert(button) in order for the button to appear.
I had code that created a button using Corona’s Widget API with code like the following:
local gameBtn = widget.newButton{ label=label, labelColor = { default={255}, over={128} }, default="button.png", over="button-over.png", width=300, height=80, fontSize=30, onRelease = onRelease -- event listener function }
A screencast of the bug behavior is shown as follows: