Runtime error bad argument #2 to 'newImageSheet' ONLY when building to iOS device

I have a game that works fine in the simulator.  I have also exported it to an Android device and it also works just fine.

However, I just added to TestFlight in iTunes Connect and installed it on an iOS device.  Now it is giving me 

Runtime error

bad argument #2 to ‘newImageSheet’ (for single frame size, ‘options’ table must contain valid ‘width’ and ‘height’ values) 

I’ve double checked the size of the images, the case, the path, and everything else I can think of.  

Any ideas as to why I would only get this error on iOS devices and not on Android devices or on the simulator?

iOS is case sensitive and Android isn’t. I suspect that you have a path or file that does not match case wise with the actual file. Just a guess.

I thought Android was case sensitive as well and it was only the simulator that wasn’t?  

Regardless, I have tripled checked file names paths and am not seeing any differences. 

I plugged in the device and checked the console messages in xcode and came across this:

WARNING:  Image size (4570,570) exceeds max texture dimension (4096).  Image will be resized to fit. 

So I guess that’s why it’s later complaining that my width/height values are not right.

My question now is, what’s the best way to fix this problem?   I made all my sprite sheets from Inkscape in a linear format from left to right.  If I resize it to be a square will I need to change the sheetOptions at all?

Currently I have:  

 sheetOptions = { width = 570, height = 570, numFrames = 8 }

Have you actually defined sheetContentWidth and sheetContentHeight (see documentation)? If you haven’t, then do.

In any case, you should reduce the overall size of those frames, because if they are 570x570, then you should package them with other images in the same sheet. As things are now, you are being extremely inefficient with your texture memory.

Easiest way to fix that is to just break the image into two or more rows, but the  best way in terms of texture memory usage is to rethink your image dimensions in general or to add other images to the sheet to fill up all that empty and wasted space.

Okay so if I do add several types of animations into the same sprite sheet, then when I go to use them on different display objects, I would use the same sheetOptions but the sequences would be different and pertain to only the frames that particular display object needs? 

You’d need to use the more complex method of defining your image sheets (again, see the documentation). You’d have different animation sequences for each sprite, but those would be found under the same table.

I think what xedur is suggesting partly is that you could also make them images to be 512 and upscale in corona to 570 which means only 11% upscale and you spend only one fourth of the text memory