Working on an update to a previously live app. Using 2015.2676.
On the simulator and Android, I have no problem, but on iOS I encountered the following error:
Runtime Error: Runtime error: bad argument #2 to 'newSprite' (ImageSheet expected, got nil) stack traceback: [C]: in function 'newSprite' ?: in function '?' ?: in function \<?:916\> (tail call): ? ?: in function \<?:122\> (tail call): ? ?: in function \<?:137\> ?: in function 'dispatchEvent' ?: in function 'gotoScene' ?: in function \<?:133\> ?: in function \<?:221\>
After a bazillion print statements, it seems like it is crashing on a widget.newSwitch() call. Any ideas?
local widget = require "widget" if system.getInfo("targetAppStore") == "apple" then widget.setTheme("widget\_theme\_ios7") else widget.setTheme("widget\_theme\_android") end local function onTouch(event) -- my touch listener end function scene:create( event ) local sceneGroup = self.view switchSound = widget.newSwitch { id = "soundswitch", left = 180, top = display.screenOriginY + 135, initialSwitchState = true, onRelease = onTouch, } end
Notice, when I use “widget_theme_io7”, I get no errors, all display items are visible, except the switch widgets, and the scene is frozen.
When I use “widget_theme_ios”, I get the error above, all display items are visible, except the switch widgets, and the scene is not frozen.
Code works perfectly on the simulator on my PC and my Mac.
Compiled code works perfectly on Android devices.
Compiled code does not work on iOS devices, but did in prior releases.