Widgets on iOS

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\>&nbsp;

After a bazillion print statements, it seems like it is crashing on a widget.newSwitch() call.  Any ideas?

thanks,

–john

Are you doing an SDK build or an Enterprise build?

Do you have any widget files included in your project?

Are you specifically including a theme file?

Rob

Hi Rob,

SDK build,  not Enterprise.

Yes, widget files included and using widget.setTheme(“widget_theme_ios”)

I made no changes to this particular scene.  Worked before, and still works for simulator and Android.

thanks!

Try: widget.setTheme(“widget_theme_ios7”)

Rob

Rob,

I tried that, and while the page now loads, the switch widgets are no longer displaying.

Seems suspiciously familiar to the bug in the current enterprise version with widget themes…   :slight_smile:

Any errors?

No errors Rob.

Can you post some code?

Already submitted as Case 41750 with a couple lines of code.

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.

Thanks,

–John

When you say no errors, just to make sure you are looking at the Xcode devices console?

I was… and no errors, but…

I noticed 2015.2682 was published with this tidbit:

  • iOS - Fix missing widget resources issue - fixes casenum 41750

So I installed it and it now works.

 

thanks,

–john

Are you doing an SDK build or an Enterprise build?

Do you have any widget files included in your project?

Are you specifically including a theme file?

Rob

Hi Rob,

SDK build,  not Enterprise.

Yes, widget files included and using widget.setTheme(“widget_theme_ios”)

I made no changes to this particular scene.  Worked before, and still works for simulator and Android.

thanks!

Try: widget.setTheme(“widget_theme_ios7”)

Rob

Rob,

I tried that, and while the page now loads, the switch widgets are no longer displaying.

Seems suspiciously familiar to the bug in the current enterprise version with widget themes…   :slight_smile:

Any errors?

No errors Rob.