Spritekit animation doesn't work in iOS7 but works in iOS8

I made a game to teach children how to count. When you press the correct number, it explodes and the next one starts to receive a glowing animation as a hint.

I noticed a while ago that this particular animation is not working in iOS7.

This is how it looks: animation

I did it using NSTimer, this and the animation method:

-(void)addGlow
{
    if (!timer) {
        [self startTimer];
    }
    SKSpriteNode* back = [SKSpriteNode spriteNodeWithTexture:self.body.texture];
    back.blendMode = SKBlendModeAdd;
    back.position = CGPointMake(0, 0 - 2);
    [back runAction:[SKAction scaleTo:0.72 duration:0] completion:nil];
    SKAction* group = [SKAction group:@[[SKAction scaleTo:1 duration:0.8],[SKAction fadeAlphaTo:0 duration:0.8]]];
    [self addChild:back];
    [back runAction:[SKAction sequence:@[group,[SKAction removeFromParent]]]];
}

      

And this is my startup method:

-(void)startTimer
{
    timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(addGlow) userInfo:nil repeats:YES];
}

      

I debugged it and the method gets called without error on both iOS versions. Any ideas on how I can find out what's going on?

+3


source to share


1 answer


I see that you are not setting zPosition. Make sure it contains what you expect. Apple made changes to the responder chain between iOS 7 and 8, so I wouldn't be surprised if they changed how zPosition is initialized.



+1


source







All Articles