I was wondering how would i pause my sprite kit scene when home button is pressed.
I found few answers here and tried it with notification center like this.
When my scene load:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(applicationDidEnterBackground)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
And then later the method that is called if enters to background:
- (void) applicationDidEnterBackground{
NSLog(@"Enter to background");
self.scene.view.paused =YES;
}
Problem here is that i get the NSLog message so applicationDidEnterBackground method is being called properly. But problem is that when I return to application my app is not on "pause" mode.
So my pause statement (self.scene.view.paused =YES;) is not being called?
If I put exact statement somewhere else in code or if I make a pause button with this statement pause works just fine.
What is the problem? Why this won't work with notification center?