Search code examples
iosobjective-csprite-kitskscene

I can not load SKView scene in iOS 7


I have a game in AppStore made with SpriteKit. Its deployment target is 7.0. Compile and runs fine until I upgraded to XCode 7.3.

I don't have any problems with IOS 8 or 9 but with 7 it simply does not load my scene.

My code to load my scene is:

@implementation levelsViewController {
   SKView *_skView;
}

- (void)viewWillLayoutSubviews {
   [super viewWillLayoutSubviews];

   // Configure the view.
   if (!_skView) {
       _skView = [[SKView alloc] initWithFrame:self.view.bounds];
       LevelsScene *scene = [[LevelsScene alloc] initWithSize:_skView.bounds.size];
       scene.scaleMode = SKSceneScaleModeAspectFill;

       _skView.showsFPS = NO;
       _skView.showsNodeCount = NO;
       _skView.showsPhysics = NO;
       // AFTER A WHILE< NEVER SHOW THE SCENE. I DONT HAVE ANY PROBLEM WITH IOS 8 or later but with 7 :(
       [_skView presentScene:scene];

       [self.view addSubview:_skView];
       [self.view sendSubviewToBack:_skView];

       ...
 }

Any help would be appreciated!


Solution

  • Finally found the workaround.

    My Scene use this class from github https://github.com/zackhsuan/ZKPulseView.

    I don't understand why, but this routine works perfect until XCode 7.3. The behavior is weird, because it's works perfect for iOS 8 and 9 but in 7, show the effect perfect, but when I press the button with effect and the scene call something with spritekit got this strange behavior.

    So, just does not used this routine exclusively for ios 7 and works.