Search code examples
xcodeios9asset-catalog

Images doesn't show on iPad 2 simulator with iOS 9


In the asset catalog I'have a image set with name "panda" for iPhone and iPad devices. 3 images for iPhone and 2 for iPad

When I run the app on iPad Air, iPad Air 2, iPad Retina, iPad 2 with iOS 8.4 the image will show on tap, but nothing happens on iPad 2 with iOS 9!

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
   /* Called when a touch begins */

    for touch in touches {
        let location = touch.locationInNode(self)

        let sprite = SKSpriteNode(imageNamed:"panda")
        print(sprite)
        sprite.position = location

        let action = SKAction.rotateByAngle(CGFloat(M_PI), duration:1)

        sprite.runAction(SKAction.repeatActionForever(action))

        self.addChild(sprite)
    }
}

Using Version 7.0

Here are the settings

enter image description here

// Edit 1.0

Apparently this is a bug, which is not fixed yet

https://forums.developer.apple.com/thread/4268 https://forums.developer.apple.com/message/36854#36854


Solution

  • Try (Objective-C)

    UIImage *img = [UIImage imageNamed:@"image"];
    SKTexture *textureBg = [SKTexture textureWithImage:img];
    SKSpriteNode *nodeBg = [SKSpriteNode spriteNodeWithTexture:textureBg];