문제

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