0

In one of my SKScenes I'm listening to the NSNotification kApplicationWillBecomeActive. Every time the app becomes active it sets the pause status of the scene to false! any ideas?

  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationAppBecameActive:) name:kNotificationAppBecameActive object:nil];

I'm looking for a solution that will help me distinguish between the cases.

Thanks

Gal Marom
  • 8,499
  • 1
  • 17
  • 19
  • Update your question with relevant code. – rmaddy Nov 09 '15 at 16:10
  • Comment accepted - I've added code. Can you pls take down the down vote? First day in StackOverflow :) –  Nov 09 '15 at 16:52
  • You also need to add the code for `notificationAppBecameActive:`. – rmaddy Nov 09 '15 at 16:54
  • 1
    Actually no code is even needed, the issue is an apple bug, not his code – Knight0fDragon Nov 09 '15 at 16:55
  • @Knight0fDragon Yes, code is needed. How can we know this is a bug in Apple's frameworks if the OP doesn't show what code they've written? – rmaddy Nov 09 '15 at 16:57
  • @rmadddy It has nothing to do with the problem thought.. I override the function at the same class and it only logs something. –  Nov 09 '15 at 17:00
  • @rmaddy no he doesn't – Gal Marom Nov 09 '15 at 17:00
  • Only because in this case it is a known bug, if this was a case where more info is needed, then I would agree that code would be posted. Sometimes having too much in an answer can be a problem as well. – Knight0fDragon Nov 09 '15 at 17:01

1 Answers1

0

Just try to override setPause and set it according to your needs

  -(void) setPaused:(BOOL)paused
 {
    [super setPaused:self.isGamePaused];
 }
Gal Marom
  • 8,499
  • 1
  • 17
  • 19
  • This answer will only work if you want 100% manual control of how the scene gets paused and unpaused. If you use animations or other automated features that changes the pause behind the scenes, you will end up having to keep track of when these things happen and change the `self.isGamePaused` variable accordingly. – Knight0fDragon Nov 09 '15 at 16:47
  • 1
    I do want 100% manual control of how the scene gets paused and unpaused. –  Nov 09 '15 at 16:54
  • In your particular circumstance it may work, but if somebody else with this problem sees it, it may not work for them, that is why I added the comment. – Knight0fDragon Nov 09 '15 at 17:00