سؤال

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.

هل كانت مفيدة؟

المحلول

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.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top