narohi narohi - 6 months ago 31
iOS Question

SpriteKit SKView no longer transitions between scenes in iOS 9

We have a code base that was written and released in 2013, but in iOS 9 the app no longer transitions visibly between

SKScene
s when the
presentScene:transition:
message is sent to our
SKView
. The
SKScene
receives the
didMoveToView:
message but the scene itself never shows on screen.

Here's what we tried:


  • Disabling
    Metal
    via the
    Info.plist

  • Using
    [SKTransition transitionWithCIFilter:duration:]
    instead of the predefined animations

  • Tweaking
    zPosition

  • Switching to regular
    UIView
    animations (this made our
    SKNode
    s disappear)

  • Making sure the transition method doesn't get called more than once

  • Explicitly setting
    pausesOutgoingScene
    to
    YES
    on the
    SKTransition



None of the above attempts fixed the issue. Note that everything transitions properly in iOS 8

Here is some sample code that doesn't work:

-(BOOL)presentTitle {
if (!titleSceneLoaded) {
return NO;
}
[skView presentScene:titleScene transition:[SKTransition fadeWithDuration:1.0]];
return YES;
}


Changing it to this makes it work again (without the transitions):

-(BOOL)presentTitle {
if (!titleSceneLoaded) {
return NO;
}
[skView presentScene:titleScene];
return YES;
}


Any suggestions on how to locate/fix/workaround the bug?

Answer

We were unable to get SKTransition to work. We talked to the developer support team, posted on the developer forums, and tried everything posted here.

It is SpriteKit bug exclusive to iOS 9. If anyone else runs into this bug on iOS 9, we switched to custom transitions utilizing UIView animateWithDuration:animations:completion:.