Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

background image causing a crash

edited December 2013 in Bugs Posts: 116

I created a background image for a game I am working on and it was working perfectly.

I then went to test on an iPad once compiled with Xcode and it crashes.

so I change the simulator to use an iPad retina and the same error occurs.

It acts like the PNG is missing..

'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: /Users/waynemichael/Library/Application Support/iPhone Simulator/7.0.3/Applications/8FF3F5D6-3694-40DD-98D0-7CBBBA740C8F/SpaceFlight.app/SpritePacks/Documents.spritepack/bg.png)'
*** First throw call stack:
(
0 CoreFoundation 0x0301b5e4 exceptionPreprocess + 180
1 libobjc.A.dylib 0x02c3a8b6 objc_exception_throw + 44
2 CoreFoundation 0x030a5578 -[__NSDictionaryM setObject:forKey:] + 888
3 CoreFoundation 0x030aa23f -[NSMutableDictionary setObject:forKeyedSubscript:] + 47
4 SpaceFlight 0x0004a682 -[TextureCache textureForSprite:width:height:] + 317
5 SpaceFlight 0x000aab51 -[SpriteManager spriteTextureFromString:width:height:cache:] + 127
6 SpaceFlight 0x0005786c sprite + 461
7 SpaceFlight 0x000e7a75 luaD_precall + 499
8 SpaceFlight 0x000f6dfe luaV_execute + 1563
9 SpaceFlight 0x000e7e93 luaD_call + 103
10 SpaceFlight 0x000e05d4 f_call + 33
11 SpaceFlight 0x000e7628 luaD_rawrunprotected + 59
12 SpaceFlight 0x000e80e7 luaD_pcall + 69
13 SpaceFlight 0x000e0598 lua_pcall + 110
14 SpaceFlight 0x0004d7e3 -[LuaState callSimpleFunction:] + 171
15 SpaceFlight 0x00005274 -[RuntimeViewController glkView:drawInRect:] + 700
16 GLKit 0x0051ac26 -[GLKView _display:] + 303
17 GLKit 0x0051b274 -[GLKView display] + 41
18 GLKit 0x0051c0ad -[GLKViewController _updateAndDraw] + 661
19 libobjc.A.dylib 0x02c4c7d2 -[NSObject performSelector:] + 62
20 GLKit 0x0051b5fa -[GLKDisplayLinkMessenger message] + 52
21 QuartzCore 0x018aab8a _ZN2CA7Display15DisplayLinkItem8dispatchEv + 48
22 QuartzCore 0x018aaa46 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 310
23 QuartzCore 0x018aaf6b _ZN2CA7Display16TimerDisplayLink8callbackEP16__CFRunLoopTimerPv + 123
24 CoreFoundation 0x02fd9bd6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION
+ 22
25 CoreFoundation 0x02fd95bd __CFRunLoopDoTimer + 1181
26 CoreFoundation 0x02fc1628 __CFRunLoopRun + 1816
27 CoreFoundation 0x02fc0ac3 CFRunLoopRunSpecific + 467
28 CoreFoundation 0x02fc08db CFRunLoopRunInMode + 123
29 GraphicsServices 0x039689e2 GSEventRunModal + 192
30 GraphicsServices 0x03968809 GSEventRun + 104
31 UIKit 0x019a8d3b UIApplicationMain + 1225
32 SpaceFlight 0x0000287d main + 141
33 SpaceFlight 0x000027e5 start + 53
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Comments

  • Posts: 1,976

    This is a glitch in the Codea Runtime, it's an error on exporting in the current Codea version. Xcode can't find the background image, basically. You might need to manually put the background image in the Documents.spritepack folder in your Xcode project.

    I wouldn't recommend exporting a Codea project to Xcode until Codea updates. Codea doesn't currently officially support iOS 7 but it will in the next update. Exports are glitchy with iOS 7 when it was designed for iOS 6. Try waiting until the next Codea update, which hopefully won't be too long, to fix all these bugs.

    In the meantime, you need to manually move your background image to the Documents.spritepack folder in your Xcode project.

  • the images are in the folder. they just act like they are not. they even get copied to the simulator.

  • Posts: 1,976

    Are they .jpg files?

  • PNG and they work on the ipad one. Just not retina.

  • @SkyTheCoder, they're .png's

  • Posts: 1,976

    @wrmichael @CodeaNoob I thought they should be PNG too, but in Planetroids I was getting errors on not being able to find images, and found they had to be JPG. For some reason PNG works in Codea but not Xcode...

  • i need transparencies. can i do that with jpg?

  • Posts: 1,976

    Not sure... I've been trying but couldn't get it to work.

  • Posts: 1,254

    For what it's worth, I had no problem using PNG. Just make sure you register the images in XCode on the Summary screen.

  • Posts: 1,976

    @Mark I think that was my problem. How do you register them?

  • or wich summary screen?

  • Posts: 1,254

    On the left column of XCode, give the project name a double click. On the Summary tab, scroll down to where the images are shown, click and select those you want to use (sorry, I'm sure these screens have specific names, but I'm away from my Mac).

  • under "Copy Bundle Resources" it has the SpritePacks folder but not the individual images.

    Maybe there is another list?

  • can it be something about the image? like resolution?

    I added the images after I created the project.

  • I pulled out the Xcode 4.6. It has the 6.0 and 6.1 simulators in it so I assume it is an XCODE 5.x issue. @simon I can test some beta updates if you have them.

  • I solved the issue. Not the way I want to solve it. It required I go into a blank a project in Codea, import the modified image I had and then export the project and copy the images from documents:sprites to my project for use.

    not perfect but it works.

  • This may already be solved by now, but I had the same issue and solved it by removing references to the the SpritePacks. Add them back by choosing "Add files" and select the sprite pack folder that you removed the references for. NOTE: make sure you change the option from "Create groups for any added folders" to "Create folder references for added folders". I compiled for iOS 7 and it appears to work well.

Sign In or Register to comment.