Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSoren Peterson
3,255 PointsSpriteKitNode displays a large red x when I load an image from an atlas.
When I load an image from the atlas in the space cat tutorial, I get a large red x when I test the app on my physical iPad Mini. It works fine when I test it in the simulator. I can load images that are not in an atlas. As far as I can tell I have followed the instructions and examples exactly. I have looked online and found that this means it is unable to load the image. It is weird because it works in the simulator but not on my iPad Mini.
4 Answers
Michael Blazek
162 PointsIf all images are named correctly it may be a problem with you making the game for an iPad when the course was designed to work for iPhone. Sprite Kit should fail properly and find any image with that matching name, but it could be looking for the asset it in the wrong place on the sim.
The last thing I would try is Open the simulator and delete the application. Then Do a CLEAN in your project in Xcode. Rebuild and run on the simulator. You can do the same for your iPad and you may then at least get the same result in both simulator and device.
SpriteSheets in Sprite Kit are built at compile time and then are saved as data. The old one may be around or the new one may not have properly been place, either way that is why you would see a difference in the device and the simulator.
Kieran Robinson
9,411 PointsHi Soren Peterson, I had this problem and it turned out that i'd spelt the name of the debris on the tutorial wrong. id put @"debris_1" whereas my assets in the atlas was spelt @"debri_1" (wrong spelling of the word, but thats what it was on my assets i downloaded). Another reason for this could be that the image you are trying to use on your iPad mini may not have a retina version. Hope I helped Kieran
Soren Peterson
3,255 PointsThanks for your replies. It turned out that the problem was in my machineNode class' initWithSize method. I had forgotten to change the creation of an SKSpriteNode to a machineNode. I assume that this caused an error when trying to add it to the scene because the pointer held a reference to an object that was not the right type.
Marshall Huss
3,504 PointsIf it works in the sim but not on device there's a chance that the filename is using the wrong case. The OS X (sim) filesystem is case insensitive where an iPhone file system is case sensitive. If you named the file "Cat" but referred to it as "cat" it might cause you these issues.