gujci
gujci

Reputation: 1284

Sprite Kit, my background image won't show on device

I have a Sprite Kit game, and a want to set the background like this:

SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@"stars"];
background.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame));
background.size = CGSizeMake(self.frame.size.width , self.frame.size.height);

[self addChild:background];

This works fine on the simulator (iphone5), but on real device (iphone5 also), a big red X image appears instead of the picture. I tried to reduce the size of the file, so it's not the biggest picture in the game (63 Kb) and still not working.

Thanks for any help.

Upvotes: 0

Views: 1280

Answers (1)

ZeMoon
ZeMoon

Reputation: 20274

The big red X means that SpriteKit could not find the image you have specified.

Big Red X

Here's what you can do to fix this:

  1. Verify that the image is a part of the bundle.
  2. Clean.
  3. Delete the app from the device.
  4. Rebuild the app into the device.

Upvotes: 1

Related Questions